Re: Couple of issues with prepared FETCH commands

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Couple of issues with prepared FETCH commands
Date: 2017-01-12 04:28:33
Message-ID: 7472.1484195313@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Tue, Jan 10, 2017 at 5:38 PM, Andrew Gierth
> <andrew(at)tao11(dot)riddles(dot)org(dot)uk> wrote:
>> But the problem that actually came up is this: if you do the PQprepare
>> before the named cursor has actually been opened, then everything works
>> _up until_ the first event, such as a change to search_path, that forces
>> a revalidation; and at that point it fails with the "must not change
>> result type" error _even if_ the cursor always has exactly the same
>> result type. This happens because the initial prepare actually stored
>> NULL for plansource->resultDesc, since the cursor name wasn't found,
>> while on the revalidate, when the cursor obviously does exist, it gets
>> the actual result type.
>>
>> It seems a bit of a "gotcha" to have it fail in this case when the
>> result type isn't actually being checked in other cases.

> To me, that sounds like a bug.

Yeah --- specifically, I wonder why we allow the reference to an
unrecognized cursor name to succeed. Or were you defining the bug
differently?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2017-01-12 04:52:11 Re: Misplacement of function declaration in contrib/postgres_fdw/postgres_fdw.h
Previous Message Tom Lane 2017-01-12 04:25:24 Re: many copies of atooid() and oid_cmp()