(2013/06/12 0:03), Tom Lane wrote:
> Hiroshi Inoue <inoue@tpf.co.jp> writes:
>> It's also better to fix the crash at backend side.
>
> Yeah, definitely. Do we have a self-contained test case for this?
Unfortunately no. I'm testing with a modified psqlodbc driver.
The simplest way may be as follows.
1. Implement an API function like PQexecPortal(portal name, count)
which sends only an execute message.
2. Call the APIs as follows.
// Connect to a database.
conn = PQxxxx(....);
//
// Not begin a transaction for simplicity.
//
// The following operation defines a holdable portal whose
// portal name = cursor_name.
PQexec(conn, "declare cursor_name cursor with hold for select ....");
// At this point the holdable cursor becomes a held portal whose
// resowner is reset to NULL. The following function call would
// crash the backend.
PQexecPortal(conn, cursor_name, 1);