修复错误语句处理不一致的问题

This commit is contained in:
luozihao
2022-12-13 19:25:45 +08:00
parent 6412f131ab
commit 9318cd8b1f
3 changed files with 23 additions and 2 deletions

View File

@ -4564,8 +4564,12 @@ void AbortCurrentTransaction(bool STP_rollback)
case TBLOCK_STARTED:
AbortTransaction(PerfectRollback, STP_rollback);
ApplyUndoActions();
CleanupTransaction();
s->blockState = TBLOCK_DEFAULT;
if (u_sess->attr.attr_storage.phony_autocommit || STP_rollback) {
CleanupTransaction();
s->blockState = TBLOCK_DEFAULT;
} else {
s->blockState = TBLOCK_ABORT;
}
break;
/*

View File

@ -255,6 +255,16 @@ SHOW autocommit;
on
(1 row)
-- error in transaction block
SET autocommit = 0;
CREATE;
ERROR: syntax error at or near ";"
LINE 1: CREATE;
^
SET autocommit = 1;
ERROR: current transaction is aborted, commands ignored until end of transaction block, firstChar[Q]
ROLLBACK;
SET autocommit = 1;
\c regression
DROP DATABASE test_db;
DROP DATABASE test_drop;

View File

@ -124,6 +124,13 @@ ROLLBACK;
SELECT * FROM test_table;
SHOW autocommit;
-- error in transaction block
SET autocommit = 0;
CREATE;
SET autocommit = 1;
ROLLBACK;
SET autocommit = 1;
\c regression
DROP DATABASE test_db;
DROP DATABASE test_drop;