Unix Technical Forum

BUG #2101: Postmaster Crash Using PL/PgSQL With %TYPE on Non-Exisiting Column

This is a discussion on BUG #2101: Postmaster Crash Using PL/PgSQL With %TYPE on Non-Exisiting Column within the pgsql Bugs forums, part of the PostgreSQL category; --> The following bug has been logged online: Bug reference: 2101 Logged by: Will Szopko Email address: dba@vilaj.com PostgreSQL version: ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Bugs

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 10:33 AM
Will Szopko
 
Posts: n/a
Default BUG #2101: Postmaster Crash Using PL/PgSQL With %TYPE on Non-Exisiting Column


The following bug has been logged online:

Bug reference: 2101
Logged by: Will Szopko
Email address: dba@vilaj.com
PostgreSQL version: 8.1.0
Operating system: Debain Linux (Sarge)/Mac OS X 10.3.9 (Panther)
Description: Postmaster Crash Using PL/PgSQL With %TYPE on
Non-Exisiting Column
Details:

The postmaster in 8.1.0 crashes when creating or replacing a PL/PgSQL
function containing an invalid variable declaration. The invalid declaration
triggering the bug combines a schema with a %TYPE applied to a non-existing
column. When a schema is not involved an appropriate error message is given.


I was able to reproduce the problem on both Mac OS X 10.3.9 and Debian Sarge
on x86.

The following illustrates the bug.

wszopko@fortress-curry:~$ createdb trash
CREATE DATABASE
wszopko@fortress-curry:~$ cat test.sql
CREATE SCHEMA junk;

SELECT version();

CREATE TABLE junk.my_table (
my_table_id SERIAL NOT NULL PRIMARY KEY,
my_column INTEGER NOT NULL DEFAULT 0);

CREATE OR REPLACE FUNCTION show_bug()
RETURNS BOOLEAN AS $PROC$
DECLARE
myColumn junk.my_table.bad_column%TYPE;

BEGIN
RETURN true;
END;
$PROC$ LANGUAGE 'plpgsql';
wszopko@fortress-curry:~$ psql -f ./test.sql trash
CREATE SCHEMA
version

----------------------------------------------------------------------------
----------------
PostgreSQL 8.1.0 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.5
(Debian 1:3.3.5-13)
(1 row)

psql:./test.sql:7: NOTICE: CREATE TABLE will create implicit sequence
"my_table_my_table_id_seq" for serial column "my_table.my_table_id"
psql:./test.sql:7: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit
index "my_table_pkey" for table "my_table"
CREATE TABLE
psql:./test.sql:17: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
psql:./test.sql:17: connection to server was lost
wszopko@fortress-curry:~$ dropdb trash
DROP DATABASE

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 10:33 AM
Tom Lane
 
Posts: n/a
Default Re: BUG #2101: Postmaster Crash Using PL/PgSQL With %TYPE on Non-Exisiting Column

"Will Szopko" <dba@vilaj.com> writes:
> The postmaster in 8.1.0 crashes when creating or replacing a PL/PgSQL
> function containing an invalid variable declaration.


Reproduced here --- thanks for the test case!

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-10-2008, 10:33 AM
Tom Lane
 
Posts: n/a
Default Re: BUG #2101: Postmaster Crash Using PL/PgSQL With %TYPE on Non-Exisiting Column

"Will Szopko" <dba@vilaj.com> writes:
> The postmaster in 8.1.0 crashes when creating or replacing a PL/PgSQL
> function containing an invalid variable declaration.


Looks like a copy-and-paste mistake...

Index: pl_comp.c
================================================== =================
RCS file: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v
retrieving revision 1.94.2.1
diff -c -r1.94.2.1 pl_comp.c
*** pl_comp.c 22 Nov 2005 18:23:30 -0000 1.94.2.1
--- pl_comp.c 9 Dec 2005 16:56:38 -0000
***************
*** 1457,1463 ****
done:
if (HeapTupleIsValid(classtup))
ReleaseSysCache(classtup);
! if (HeapTupleIsValid(classtup))
ReleaseSysCache(attrtup);
if (HeapTupleIsValid(typetup))
ReleaseSysCache(typetup);
--- 1457,1463 ----
done:
if (HeapTupleIsValid(classtup))
ReleaseSysCache(classtup);
! if (HeapTupleIsValid(attrtup))
ReleaseSysCache(attrtup);
if (HeapTupleIsValid(typetup))
ReleaseSysCache(typetup);


regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:07 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com