Re: [BUGS] BUG #2129: dblink problem - Mailing list pgsql-patches

From Joe Conway
Subject Re: [BUGS] BUG #2129: dblink problem
Date
Msg-id 43BA0709.5010106@joeconway.com
Whole thread Raw
In response to Re: [BUGS] BUG #2129: dblink problem  (Joe Conway <mail@joeconway.com>)
Responses Re: [BUGS] BUG #2129: dblink problem
List pgsql-patches
Joe Conway wrote:
> However, there is a remaining oddity with dblink_fetch(). Basically,
> each time dblink_fetch() is called, the named cursor is advanced, even
> though an error is thrown before returning any rows. Is there a simple
> way to get the number of columns in the result, without actually
> advancing the cursor?

I thought I could work around this issue by obtaining the count returned
for the FETCH using PQcmdTuples(), and then issuing a "MOVE BACWARD
n..." in the case where the return tuple doesn't match. However I get an
empty string:

(gdb) p str->data
$34 = 0x8a4e5a8 "FETCH 2 FROM rmt_foo_cursor"
(gdb) p PQcmdStatus(res)
$35 = 0x8a447c8 "FETCH"
(gdb) p PQcmdTuples(res)
$36 = 0x29dada ""

Any ideas why this isn't working?

Thanks,

Joe

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: ShmemIndexLock rewrite
Next
From: Simon Riggs
Date:
Subject: Re: Stats collector performance improvement