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

Re: Bug in PL/pgSQL FOR cursor variant

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: PostgreSQL Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Bug in PL/pgSQL FOR cursor variant
Date: 2010-06-21 14:08:47
Message-ID: 11897.1277129327@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> writes:
> The problem is that exec_stmt_forc keeps using a pointer to the Portal, 
> which becomes invalid if the cursor is closed in the middle. Patch 
> attached, will apply..

Does that really fix anything?  I suspect you need to pstrdup() the
portalname.  Also, isn't exec_for_query() at just as much risk?
The latter's problem would only be exposed if the cursor was closed
at a batch boundary, but it's still a problem.

I wonder whether we ought to try to make it an error to close a portal
that's still in use.

			regards, tom lane

In response to

Responses

pgsql-bugs by date

Next:From: Greg StarkDate: 2010-06-21 14:59:16
Subject: Re: BUG #5516: Memory grows up problem
Previous:From: YuhuiDate: 2010-06-21 11:41:51
Subject: BUG #5516: Memory grows up problem

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