PostgreSQL: Features new in 7.4: Holdable Cursors

  • Pre 7.4: cursors only inside transaction blocks
template1=# begin;
BEGIN
template1=# declare foo cursor for select relname from pg_class;
DECLARE
template1=# fetch foo;
 relname
---------
 pg_type
(1 row)

(1 row)

template1=# commit;
  • Add WITH HOLD -- cursors can exist outside and across transaction blocks
  • Important for SQL compliance and compatibility with other databases
Prev

Next

Page 9