Re: [JDBC] V3 protocol + DECLARE problems - Mailing list pgsql-hackers

From Oliver Jowett
Subject Re: [JDBC] V3 protocol + DECLARE problems
Date
Msg-id 40FFA5C0.7050701@opencloud.com
Whole thread Raw
In response to Re: [JDBC] V3 protocol + DECLARE problems  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [JDBC] V3 protocol + DECLARE problems  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: [JDBC] V3 protocol + DECLARE problems  (Oliver Jowett <oliver@opencloud.com>)
List pgsql-hackers
Tom Lane wrote:

[... DECLARE with parameters failing ...]

>>Any chance of getting this fixed for 7.5?
> 
> 
> I'm up to my keister in PITR and nested-xact issues and won't have time
> to look at it soon.  Do you want to take a look and see if you can find
> where the ball is getting dropped?

Here's what I've found so far:

The error occurs where it does because it is a DECLARE CURSOR WITH HOLD 
outside an explicit transaction, so the resulting cursor is immediately 
materialized when the implicit commit at end of statement happens. This 
implicitly fetches all rows, and it's the fetch that fails.

When the DECLARE is enclosed in an explicit transaction, it succeeds, 
but then subsequent FETCHes fail with the same error.

DECLARE -> PerformCursorOpen always passes NULL as a parameter list to 
PortalStart() on the newly created portal, so no parameters are 
available when executing it.

It seems like we should pass the original parameters from execution of 
the DECLARE utility portal down through PortalRunUtility -> 
ProcessUtility -> PerformCursorOpen, copy them into the newly created 
portal's memory context, and pass the copies to PortalStart on the new 
portal.

Does that sound about right?

-O


pgsql-hackers by date:

Previous
From: "Zeugswetter Andreas SB SD"
Date:
Subject: Re: [pgsql-hackers-win32] Weird new time zone
Next
From: Bruce Momjian
Date:
Subject: Re: Completed TODO item?