summaryrefslogtreecommitdiff
path: root/src/backend/tcop/utility.c
diff options
context:
space:
mode:
authorDean Rasheed <dean.a.rasheed@gmail.com>2021-07-15 08:49:45 +0100
committerDean Rasheed <dean.a.rasheed@gmail.com>2021-07-15 08:49:45 +0100
commit2bfb50b3df11399ed80347dd03bfaf8cd5acf962 (patch)
tree126051120d4735ba8619d4102a65e92d366f36e0 /src/backend/tcop/utility.c
parentffc9ddaea33f6dfd3dfa95828a0970fbb617bf8a (diff)
Improve reporting of "conflicting or redundant options" errors.
When reporting "conflicting or redundant options" errors, try to ensure that errposition() is used, to help the user identify the offending option. Formerly, errposition() was invoked in less than 60% of cases. This patch raises that to over 90%, but there remain a few places where the ParseState is not readily available. Using errdetail() might improve the error in such cases, but that is left as a task for the future. Additionally, since this error is thrown from over 100 places in the codebase, introduce a dedicated function to throw it, reducing code duplication. Extracted from a slightly larger patch by Vignesh C. Reviewed by Bharath Rupireddy, Alvaro Herrera, Dilip Kumar, Hou Zhijie, Peter Smith, Daniel Gustafsson, Julien Rouhaud and me. Discussion: https://postgr.es/m/CALDaNm33FFSS5tVyvmkoK2cCMuDVxcui=gFrjti9ROfynqSAGA@mail.gmail.com
Diffstat (limited to 'src/backend/tcop/utility.c')
-rw-r--r--src/backend/tcop/utility.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index 7a2da9dab43..27fbf1f3aae 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -708,7 +708,7 @@ standard_ProcessUtility(PlannedStmt *pstmt,
break;
case T_DoStmt:
- ExecuteDoStmt((DoStmt *) parsetree, isAtomicContext);
+ ExecuteDoStmt(pstate, (DoStmt *) parsetree, isAtomicContext);
break;
case T_CreateTableSpaceStmt:
@@ -888,7 +888,7 @@ standard_ProcessUtility(PlannedStmt *pstmt,
case T_AlterRoleStmt:
/* no event triggers for global objects */
- AlterRole((AlterRoleStmt *) parsetree);
+ AlterRole(pstate, (AlterRoleStmt *) parsetree);
break;
case T_AlterRoleSetStmt:
@@ -1552,11 +1552,11 @@ ProcessUtilitySlow(ParseState *pstate,
break;
case T_CreateFdwStmt:
- address = CreateForeignDataWrapper((CreateFdwStmt *) parsetree);
+ address = CreateForeignDataWrapper(pstate, (CreateFdwStmt *) parsetree);
break;
case T_AlterFdwStmt:
- address = AlterForeignDataWrapper((AlterFdwStmt *) parsetree);
+ address = AlterForeignDataWrapper(pstate, (AlterFdwStmt *) parsetree);
break;
case T_CreateForeignServerStmt:
@@ -1601,7 +1601,7 @@ ProcessUtilitySlow(ParseState *pstate,
break;
case T_CreateRangeStmt: /* CREATE TYPE AS RANGE */
- address = DefineRange((CreateRangeStmt *) parsetree);
+ address = DefineRange(pstate, (CreateRangeStmt *) parsetree);
break;
case T_AlterEnumStmt: /* ALTER TYPE (enum) */
@@ -1802,11 +1802,11 @@ ProcessUtilitySlow(ParseState *pstate,
break;
case T_CreatePublicationStmt:
- address = CreatePublication((CreatePublicationStmt *) parsetree);
+ address = CreatePublication(pstate, (CreatePublicationStmt *) parsetree);
break;
case T_AlterPublicationStmt:
- AlterPublication((AlterPublicationStmt *) parsetree);
+ AlterPublication(pstate, (AlterPublicationStmt *) parsetree);
/*
* AlterPublication calls EventTriggerCollectSimpleCommand
@@ -1816,12 +1816,14 @@ ProcessUtilitySlow(ParseState *pstate,
break;
case T_CreateSubscriptionStmt:
- address = CreateSubscription((CreateSubscriptionStmt *) parsetree,
+ address = CreateSubscription(pstate,
+ (CreateSubscriptionStmt *) parsetree,
isTopLevel);
break;
case T_AlterSubscriptionStmt:
- address = AlterSubscription((AlterSubscriptionStmt *) parsetree,
+ address = AlterSubscription(pstate,
+ (AlterSubscriptionStmt *) parsetree,
isTopLevel);
break;