diff --git a/src/common/backend/parser/gram.y b/src/common/backend/parser/gram.y index ac0d6f62e..4ab1c60a5 100644 --- a/src/common/backend/parser/gram.y +++ b/src/common/backend/parser/gram.y @@ -19064,6 +19064,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;