Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4fe2012

Browse files
author
Neil Conway
committed
Add regression tests for recent cursor/savepoint bug fixed by Alvaro and
Tom.
1 parentaba691b commit4fe2012

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

‎src/test/regress/expected/transactions.out

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,3 +470,50 @@ ROLLBACK;
470470
DROP TABLE foo;
471471
DROP TABLE baz;
472472
DROP TABLE barbaz;
473+
-- verify that cursors created during an aborted subtransaction are
474+
-- closed, but that we do not rollback the effect of any FETCHs
475+
-- performed in the aborted subtransaction
476+
begin;
477+
savepoint x;
478+
create table abc (a int);
479+
insert into abc values (5);
480+
insert into abc values (10);
481+
declare foo cursor for select * from abc;
482+
fetch from foo;
483+
a
484+
---
485+
5
486+
(1 row)
487+
488+
rollback to x;
489+
-- should fail
490+
fetch from foo;
491+
ERROR: cursor "foo" does not exist
492+
commit;
493+
begin;
494+
create table abc (a int);
495+
insert into abc values (5);
496+
insert into abc values (10);
497+
insert into abc values (15);
498+
declare foo cursor for select * from abc;
499+
fetch from foo;
500+
a
501+
---
502+
5
503+
(1 row)
504+
505+
savepoint x;
506+
fetch from foo;
507+
a
508+
----
509+
10
510+
(1 row)
511+
512+
rollback to x;
513+
fetch from foo;
514+
a
515+
----
516+
15
517+
(1 row)
518+
519+
abort;

‎src/test/regress/sql/transactions.sql

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,3 +290,38 @@ ROLLBACK;
290290
DROPTABLE foo;
291291
DROPTABLE baz;
292292
DROPTABLE barbaz;
293+
294+
-- verify that cursors created during an aborted subtransaction are
295+
-- closed, but that we do not rollback the effect of any FETCHs
296+
-- performed in the aborted subtransaction
297+
begin;
298+
299+
savepoint x;
300+
createtableabc (aint);
301+
insert into abcvalues (5);
302+
insert into abcvalues (10);
303+
declare foo cursor forselect*from abc;
304+
fetchfrom foo;
305+
rollback to x;
306+
307+
-- should fail
308+
fetchfrom foo;
309+
commit;
310+
311+
begin;
312+
313+
createtableabc (aint);
314+
insert into abcvalues (5);
315+
insert into abcvalues (10);
316+
insert into abcvalues (15);
317+
declare foo cursor forselect*from abc;
318+
319+
fetchfrom foo;
320+
321+
savepoint x;
322+
fetchfrom foo;
323+
rollback to x;
324+
325+
fetchfrom foo;
326+
327+
abort;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp