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 ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster