PostgreSQL 8.3beta3 Documentation | ||||
---|---|---|---|---|
Prev | Fast Backward | Fast Forward | Next |
dblink_fetch(text cursorname, int32 howmany [, bool fail_on_error]) dblink_fetch(text connname, text cursorname, int32 howmany [, bool fail_on_error])
if three arguments are present, the first is taken as the specific connection name to use; otherwise the unnamed connection is assumed
On a mismatch between the number of return fields as specified in the FROM clause, and the actual number of fields returned by the remote cursor, an ERROR will be thrown. In this event, the remote cursor is still advanced by as many rows as it would have been if the ERROR had not occurred.
test=# select dblink_connect('dbname=postgres'); dblink_connect ---------------- OK (1 row) test=# select dblink_open('foo','select proname, prosrc from pg_proc where proname like ''bytea%'''); dblink_open ------------- OK (1 row) test=# select * from dblink_fetch('foo',5) as (funcname name, source text); funcname | source ----------+---------- byteacat | byteacat byteacmp | byteacmp byteaeq | byteaeq byteage | byteage byteagt | byteagt (5 rows) test=# select * from dblink_fetch('foo',5) as (funcname name, source text); funcname | source -----------+----------- byteain | byteain byteale | byteale bytealike | bytealike bytealt | bytealt byteane | byteane (5 rows) test=# select * from dblink_fetch('foo',5) as (funcname name, source text); funcname | source ------------+------------ byteanlike | byteanlike byteaout | byteaout (2 rows) test=# select * from dblink_fetch('foo',5) as (funcname name, source text); funcname | source ----------+-------- (0 rows)