Re: postgres crash on CURSORS - Mailing list pgsql-hackers

From Tom Lane
Subject Re: postgres crash on CURSORS
Date
Msg-id 17748.954947053@sss.pgh.pa.us
Whole thread Raw
In response to RE: postgres crash on CURSORS  ("Hiroshi Inoue" <Inoue@tpf.co.jp>)
Responses RE: postgres crash on CURSORS
List pgsql-hackers
"Hiroshi Inoue" <Inoue@tpf.co.jp> writes:
> Current abort check seems too late.
> For example,is the following behavior preferable ?

> =# begin;
> BEGIN
> =# aaa;
> ERROR:  parser: parse error at or near "aaa"
> =# select * from aaaa;
> ERROR:  Relation 'aaaa' does not exist
>     ?? existence check ?? Why ??

> reindex=# select * from t; -- t is a existent table
> NOTICE:  (transaction aborted): queries ignored until END
> *ABORT STATE*

Hmm.  The error of course appears because we perform parsing and
rewriting before checking for abort. I am not sure whether the rewriter
can introduce begin/commit commands at present, but I would not like to
design the front-end processing on the assumption that it can never do so.
So I think we have to run the query that far before we think about
aborting.

>> If we are in abort state and
>> the submitted query string is
>> 
>> SELECT foo ; ROLLBACK ; SELECT bar
>> 
>> it seems to me that the correct response is to reject the first select
>> and process the second.  The currently committed code does so, but
>> your patch would fail.

> It seems pg_parse_and_plan() returns NIL plan_list and NIL
> querytree_list in this case.

You're not looking at current CVS ;-)
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: AIX and gcc (was: bug in nabstime.c)
Next
From: Bruce Momjian
Date:
Subject: Doc updates