1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-12 21:01:52 +03:00

Change SET LOCAL/CONSTRAINTS/TRANSACTION and ABORT behavior

Change SET LOCAL/CONSTRAINTS/TRANSACTION behavior outside of a
transaction block from error (post-9.3) to warning.  (Was nothing in <=
9.3.)  Also change ABORT outside of a transaction block from notice to
warning.
This commit is contained in:
Bruce Momjian
2013-11-25 19:19:40 -05:00
parent 05b476c298
commit a6542a4b68
11 changed files with 47 additions and 28 deletions

View File

@ -6274,7 +6274,7 @@ ExecSetVariableStmt(VariableSetStmt *stmt, bool isTopLevel)
case VAR_SET_VALUE:
case VAR_SET_CURRENT:
if (stmt->is_local)
RequireTransactionChain(isTopLevel, "SET LOCAL");
WarnNoTransactionChain(isTopLevel, "SET LOCAL");
(void) set_config_option(stmt->name,
ExtractSetVariableArgs(stmt),
(superuser() ? PGC_SUSET : PGC_USERSET),
@ -6295,7 +6295,7 @@ ExecSetVariableStmt(VariableSetStmt *stmt, bool isTopLevel)
{
ListCell *head;
RequireTransactionChain(isTopLevel, "SET TRANSACTION");
WarnNoTransactionChain(isTopLevel, "SET TRANSACTION");
foreach(head, stmt->args)
{
@ -6346,7 +6346,7 @@ ExecSetVariableStmt(VariableSetStmt *stmt, bool isTopLevel)
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("SET LOCAL TRANSACTION SNAPSHOT is not implemented")));
RequireTransactionChain(isTopLevel, "SET TRANSACTION");
WarnNoTransactionChain(isTopLevel, "SET TRANSACTION");
Assert(IsA(con, A_Const));
Assert(nodeTag(&con->val) == T_String);
ImportSnapshot(strVal(&con->val));
@ -6357,11 +6357,11 @@ ExecSetVariableStmt(VariableSetStmt *stmt, bool isTopLevel)
break;
case VAR_SET_DEFAULT:
if (stmt->is_local)
RequireTransactionChain(isTopLevel, "SET LOCAL");
WarnNoTransactionChain(isTopLevel, "SET LOCAL");
/* fall through */
case VAR_RESET:
if (strcmp(stmt->name, "transaction_isolation") == 0)
RequireTransactionChain(isTopLevel, "RESET TRANSACTION");
WarnNoTransactionChain(isTopLevel, "RESET TRANSACTION");
(void) set_config_option(stmt->name,
NULL,