Hackers,

While playing with code to enable subtransactions in the storage
manager, I run across this strangeness:

alvherre=# begin; begin;			-- start a subtransaction
BEGIN
BEGIN
alvherre=# drop table foo;			-- no such table
ERROR:  no existe la tabla "foo"
alvherre=# commit;
ERROR:  cannot drop active portal
alvherre=# 


This happens while PortalDrop() tries to drop an active portal.  In this
state, I can't do anything else short of closing the connection.  But
this doesn't happen if I try to run a non-utility bogus statement
("SELECT foo"); the system then allows me to rollback the transaction.

Why is a portal kept active after a utility statement fails?  I've been
reading tcop/postgres.c but I can't find what's different between
utility and non-utility.

Any clues?

-- 
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"People get annoyed when you try to debug them."  (Larry Wall)

Wed, 21 Apr 2004 22:06:50 -0400
Alvaro Herrera <alvherre@dcc.uchile.cl>
cannot drop active portal
I wrote earlier:

> alvherre=# commit;
> ERROR:  cannot drop active portal
> 
> This happens while PortalDrop() tries to drop an active portal.  In this
> state, I can't do anything else short of closing the connection.  But
> this doesn't happen if I try to run a non-utility bogus statement
> ("SELECT foo"); the system then allows me to rollback the transaction.

Obviously I have to drop the unnamed portal in some kind of
AtSubAbort_Portals ... this means I will have to bite the bullet and get
a new transaction ID, which I was kind of postponing ... sorry for the noise.

-- 
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
Jajaja! Solo hablaba en serio!

Wed, 21 Apr 2004 23:25:40 -0400
Alvaro Herrera <alvherre@dcc.uchile.cl>
Re: cannot drop active portal
Alvaro Herrera <alvherre@dcc.uchile.cl> writes:
> Why is a portal kept active after a utility statement fails?

I think you've broken AtAbort_Portals ...

			regards, tom lane

Thu, 22 Apr 2004 00:39:21 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: cannot drop active portal 