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

Commit99bb9c5

Browse files
committed
Fix interaction between psql \set AUTOCOMMIT and "ON_ERROR_ROLLBACK"
by properly updating transaction state after AUTOCOMMIT.
1 parent8d86982 commit99bb9c5

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

‎src/bin/psql/common.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.104 2005/06/22 21:14:30 tgl Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.105 2005/09/20 21:43:08 momjian Exp $
77
*/
88
#include"postgres_fe.h"
99
#include"common.h"
@@ -1010,13 +1010,15 @@ SendQuery(const char *query)
10101010
return false;
10111011
}
10121012
PQclear(results);
1013+
transaction_status=PQtransactionStatus(pset.db);
10131014
}
1014-
elseif (transaction_status==PQTRANS_INTRANS&&
1015-
(rollback_str=GetVariable(pset.vars,"ON_ERROR_ROLLBACK"))!=NULL&&
1016-
/* !off and !interactive is 'on' */
1017-
pg_strcasecmp(rollback_str,"off")!=0&&
1018-
(pset.cur_cmd_interactive||
1019-
pg_strcasecmp(rollback_str,"interactive")!=0))
1015+
1016+
if (transaction_status==PQTRANS_INTRANS&&
1017+
(rollback_str=GetVariable(pset.vars,"ON_ERROR_ROLLBACK"))!=NULL&&
1018+
/* !off and !interactive is 'on' */
1019+
pg_strcasecmp(rollback_str,"off")!=0&&
1020+
(pset.cur_cmd_interactive||
1021+
pg_strcasecmp(rollback_str,"interactive")!=0))
10201022
{
10211023
if (on_error_rollback_warning== false&&pset.sversion<80000)
10221024
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp