From 38cdb3d3d950e39ce0b660060011dc844fef68a0 Mon Sep 17 00:00:00 2001 From: weiwentao <1375910710@qq.com> Date: Mon, 10 Jul 2023 20:05:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0B=E6=A8=A1=E5=BC=8F=E9=99=90?= =?UTF-8?q?=E5=88=B6=EF=BC=8Cconsistent=20snapshot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/backend/parser/gram.y | 9 +++++++++ src/test/regress/input/transaction_with_snapshot.source | 2 ++ src/test/regress/output/transaction_with_snapshot.source | 5 +++++ 3 files changed, 16 insertions(+) diff --git a/src/common/backend/parser/gram.y b/src/common/backend/parser/gram.y index a105fb82a..3be217263 100644 --- a/src/common/backend/parser/gram.y +++ b/src/common/backend/parser/gram.y @@ -19059,6 +19059,15 @@ TransactionStmt: } | START TRANSACTION WITH CONSISTENT SNAPSHOT { + if (!DB_IS_CMPT(B_FORMAT)) { + const char* message = "WITH CONSISTENT SNAPSHOT is supported only in B-format database."; + InsertErrorMessage(message, u_sess->plsql_cxt.plpgsql_yylloc); + ereport(errstate, + (errmodule(MOD_PARSER), + errcode(ERRCODE_SYNTAX_ERROR), + errmsg("WITH CONSISTENT SNAPSHOT is supported only in B-format database."), + parser_errposition(@3))); + } TransactionStmt *n = makeNode(TransactionStmt); n->kind = TRANS_STMT_START; n->options = NIL; diff --git a/src/test/regress/input/transaction_with_snapshot.source b/src/test/regress/input/transaction_with_snapshot.source index 9047bb74c..f23796eb7 100644 --- a/src/test/regress/input/transaction_with_snapshot.source +++ b/src/test/regress/input/transaction_with_snapshot.source @@ -1,3 +1,5 @@ +\c regression +start transaction with consistent snapshot; create database with_snapshot_test dbcompatibility 'b'; \c with_snapshot_test; set global transaction isolation level repeatable read; diff --git a/src/test/regress/output/transaction_with_snapshot.source b/src/test/regress/output/transaction_with_snapshot.source index d7fdf2498..4c9c48a61 100644 --- a/src/test/regress/output/transaction_with_snapshot.source +++ b/src/test/regress/output/transaction_with_snapshot.source @@ -1,3 +1,8 @@ +\c regression +start transaction with consistent snapshot; +ERROR: WITH CONSISTENT SNAPSHOT is supported only in B-format database. +LINE 1: start transaction with consistent snapshot; + ^ create database with_snapshot_test dbcompatibility 'b'; \c with_snapshot_test; set global transaction isolation level repeatable read;