dbTalk Databases Forums  

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

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #2101: Postmaster Crash Using PL/PgSQL With %TYPE on Non-Exisiting Column in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Will Szopko
 
Posts: n/a

Default [BUGS] BUG #2101: Postmaster Crash Using PL/PgSQL With %TYPE on Non-Exisiting Column - 12-09-2005 , 10:22 AM







The following bug has been logged online:

Bug reference: 2101
Logged by: Will Szopko
Email address: dba (AT) vilaj (DOT) 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

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] BUG #2101: Postmaster Crash Using PL/PgSQL With %TYPE on Non-Exisiting Column - 12-09-2005 , 10:36 AM






"Will Szopko" <dba (AT) vilaj (DOT) com> writes:
Quote:
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


Reply With Quote
  #3  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] BUG #2101: Postmaster Crash Using PL/PgSQL With %TYPE on Non-Exisiting Column - 12-09-2005 , 11:10 AM



"Will Szopko" <dba (AT) vilaj (DOT) com> writes:
Quote:
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


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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.