PostgreSQL 8.3beta3 Documentation | ||||
---|---|---|---|---|
Prev | Fast Backward | Fast Forward | Next |
Blocks until a result gets available. This function *must* be called if dblink_send_query returned a 1, even on cancelled queries - otherwise the connection can't be used anymore. It must be called once for each query sent, and one additional time to obtain an empty set result, prior to using the connection again.
contrib_regression=# SELECT dblink_connect('dtest1', 'dbname=contrib_regression'); dblink_connect ---------------- OK (1 row) contrib_regression=# SELECT * from contrib_regression-# dblink_send_query('dtest1', 'select * from foo where f1 < 3') as t1; t1 ---- 1 (1 row) contrib_regression=# SELECT * from dblink_get_result('dtest1') as t1(f1 int, f2 text, f3 text[]); f1 | f2 | f3 ----+----+------------ 0 | a | {a0,b0,c0} 1 | b | {a1,b1,c1} 2 | c | {a2,b2,c2} (3 rows) contrib_regression=# SELECT * from dblink_get_result('dtest1') as t1(f1 int, f2 text, f3 text[]); f1 | f2 | f3 ----+----+---- (0 rows) contrib_regression=# SELECT * from dblink_send_query('dtest1', 'select * from foo where f1 < 3; select * from foo where f1 > 6') as t1; t1 ---- 1 (1 row) contrib_regression=# SELECT * from dblink_get_result('dtest1') as t1(f1 int, f2 text, f3 text[]); f1 | f2 | f3 ----+----+------------ 0 | a | {a0,b0,c0} 1 | b | {a1,b1,c1} 2 | c | {a2,b2,c2} (3 rows) contrib_regression=# SELECT * from dblink_get_result('dtest1') as t1(f1 int, f2 text, f3 text[]); f1 | f2 | f3 ----+----+--------------- 7 | h | {a7,b7,c7} 8 | i | {a8,b8,c8} 9 | j | {a9,b9,c9} 10 | k | {a10,b10,c10} (4 rows) contrib_regression=# SELECT * from dblink_get_result('dtest1') as t1(f1 int, f2 text, f3 text[]); f1 | f2 | f3 ----+----+---- (0 rows)