Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Postgresql Postgres中的游标_Postgresql_Cursor - Fatal编程技术网

Postgresql Postgres中的游标

Postgresql Postgres中的游标,postgresql,cursor,Postgresql,Cursor,游标是否永久存储在Postgres中?我问的原因是我有以下几点: BEGIN; DECLARE cpc CURSOR for select * from project.car order by rego, date; FETCH 1 IN cpc; CLOSE cpc; COMMIT; 然后我启动一个新事务: BEGIN; OPEN cpc; fetch 1 in cpc; CLOSE cpc; COMMIT; 但得到错误:“error:cursor“cpc”不存在,SQL状态:3400

游标是否永久存储在Postgres中?我问的原因是我有以下几点:

BEGIN;
DECLARE cpc CURSOR for select * from project.car order by rego, date;
FETCH  1 IN cpc;
CLOSE cpc;
COMMIT;
然后我启动一个新事务:

BEGIN;
OPEN cpc;
fetch 1 in cpc;
CLOSE cpc;
COMMIT;
但得到错误:“error:cursor“cpc”不存在,SQL状态:34000”


有没有办法在事务之间持久化游标?

游标是事务的本地游标,在事务提交或回滚时不再存在

您可以选择提交后持久化的,尽管它们仅在创建它们的会话中保持可见