mirror of
https://github.com/postgres/postgres.git
synced 2025-05-05 09:19:17 +03:00
- During dblink_open, if transaction state was IDLE, force cursor count to
initially be 0. This is needed as a previous ABORT might have wiped out an automatically opened transaction without maintaining the cursor count. - Fix regression test expected file for the correct ERROR message, which we now get given the above bug fix.
This commit is contained in:
parent
ca1d26338b
commit
e582d2ee1a
@ -354,6 +354,13 @@ dblink_open(PG_FUNCTION_ARGS)
|
|||||||
DBLINK_RES_INTERNALERROR("begin error");
|
DBLINK_RES_INTERNALERROR("begin error");
|
||||||
PQclear(res);
|
PQclear(res);
|
||||||
rconn->newXactForCursor = TRUE;
|
rconn->newXactForCursor = TRUE;
|
||||||
|
/*
|
||||||
|
* Since transaction state was IDLE, we force cursor count to
|
||||||
|
* initially be 0. This is needed as a previous ABORT might
|
||||||
|
* have wiped out our transaction without maintaining the
|
||||||
|
* cursor count for us.
|
||||||
|
*/
|
||||||
|
rconn->openCursorCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if we started a transaction, increment cursor count */
|
/* if we started a transaction, increment cursor count */
|
||||||
|
@ -509,7 +509,7 @@ SELECT dblink_close('myconn','rmt_foo_cursor');
|
|||||||
-- this should fail because there is no open transaction
|
-- this should fail because there is no open transaction
|
||||||
SELECT dblink_exec('myconn','DECLARE xact_test CURSOR FOR SELECT * FROM foo');
|
SELECT dblink_exec('myconn','DECLARE xact_test CURSOR FOR SELECT * FROM foo');
|
||||||
ERROR: sql error
|
ERROR: sql error
|
||||||
DETAIL: ERROR: cursor "xact_test" already exists
|
DETAIL: ERROR: DECLARE CURSOR may only be used in transaction blocks
|
||||||
|
|
||||||
-- reset remote transaction state
|
-- reset remote transaction state
|
||||||
SELECT dblink_exec('myconn','ABORT');
|
SELECT dblink_exec('myconn','ABORT');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user