Skip site navigation (1) Skip section navigation (2)

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

From: "Will Szopko" <dba(at)vilaj(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #2101: Postmaster Crash Using PL/PgSQL With %TYPE on Non-Exisiting Column
Date: 2005-12-08 15:39:52
Message-ID: 20051208153952.43677F0B5B@svr2.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
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(at)fortress-curry:~$ createdb trash
CREATE DATABASE
wszopko(at)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(at)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(at)fortress-curry:~$ dropdb trash
DROP DATABASE

Responses

pgsql-bugs by date

Next:From: Bruce MomjianDate: 2005-12-08 15:53:02
Subject: Re: BUG #1467: fe_connect doesn't handle EINTR right
Previous:From: Seneca CunninghamDate: 2005-12-08 15:07:50
Subject: Re: BUG #2094: AIX: libraries contain the symbol main

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group