From: | Joseph Barillari <jbarilla(at)princeton(dot)edu> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Syntax error in plpgsql crashes backend |
Date: | 2002-05-04 18:09:18 |
Message-ID: | m3wuujhjjl.fsf@washer.barillari.org |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
I've found a pathological function input that crashes the backend.
Note the profusion of 'blah' text and the lack of an 'end;'
statement. Less text or an end statement stops this function from
provoking a crash.
CREATE OR REPLACE FUNCTION foo()
RETURNS INTEGER
AS '
DECLARE
querystr TEXT;
BEGIN
querystr := ''
-- blah blah blah blah blah blah blah blah blah blah blah
-- blah blah blah blah blah blah blah blah blah blah blah
-- blah blah blah blah blah blah blah blah blah blah blah
-- blah blah blah blah blah blah blah blah blah blah blah
-- blah blah blah blah blah blah blah blah blah blah blah
-- blah blah blah blah blah blah blah blah blah blah blah
-- blah blah blah blah blah blah blah blah blah blah blah
-- blah blah blah blah blah blah blah blah blah blah blah
-- blah blah blah blah blah blah blah blah blah blah blah
-- blah blah blah blah blah blah blah blah blah blah blah
-- blah blah blah blah blah blah blah blah blah blah blah
-- blah blah blah blah blah blah blah blah blah blah blah
-- blah blah blah blah blah blah blah blah blah blah blah
-- blah blah blah blah blah blah blah blah blah blah blah
-- blah blah blah blah blah blah blah blah blah blah blah
-- blah blah blah blah blah blah blah blah blah blah blah
-- blah blah blah blah blah blah blah blah blah blah blah
-- blah blah blah blah blah blah blah blah blah blah blah
-- blah blah blah blah blah blah blah blah blah blah blah
-- blah blah blah blah blah blah blah blah blah blah blah
-- blah blah blah blah blah blah blah blah blah blah blah
-- blah blah blah blah blah blah blah blah blah blah blah
-- blah blah blah blah blah blah blah blah blah blah blah
-- blah blah blah blah blah blah blah blah blah blah blah
-- blah blah blah blah blah blah blah blah blah blah blah
-- blah blah blah blah blah blah blah blah blah blah blah
'';
return 1;
'
language 'plpgsql';
When I load this function and try to execute it, I get a syntax error:
cal=> \i test
CREATE
cal=> select foo();
NOTICE: plpgsql: ERROR during compile of foo near line 60
ERROR: parse error at or near ""
If I try it again, the backend crashes:
cal=> select foo();
NOTICE: plpgsql: ERROR during compile of foo near line 60
ERROR: parse error at or near ""
pqReadData() -- backend closed the channel unexpectedly.
This probably means the backend terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!>
I get the following output from the postmaster:
ERROR: parse error at or near ""
NOTICE: plpgsql: ERROR during compile of foo near line 60
DEBUG: server process (pid 17990) was terminated by signal 11
DEBUG: terminating any other active server processes
DEBUG: all server processes terminated; reinitializing shared memory and semaphores
DEBUG: database system was interrupted at 2002-05-04 14:03:46 EDT
DEBUG: checkpoint record is at 0/41FFA70
DEBUG: redo record is at 0/41FFA70; undo record is at 0/0; shutdown TRUE
DEBUG: next transaction id: 41659; next oid: 147628
DEBUG: database system was not properly shut down; automatic recovery in progress
DEBUG: redo starts at 0/41FFAB0
DEBUG: ReadRecord: record with zero length at 0/4205D4C
DEBUG: redo done at 0/4205D28
FATAL 1: The database system is starting up
DEBUG: database system is ready
I anticipate that the correct response is `Don't do that then!' But I
assume someone would want to know about crashes like
this.
I'm using PostgreSQL 7.2, compiled with `gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-85)'
--Joe
From | Date | Subject | |
---|---|---|---|
Next Message | Ian Barwick | 2002-05-04 18:19:34 | Re: difficult query |
Previous Message | Jakub Ouhrabka | 2002-05-04 17:34:03 | Re: difficult query |