8000 Remove nodeToString() support in the Command Triggers API · dimitri/postgres@447b88b · GitHub
[go: up one dir, main page]

Skip to content

Commit 447b88b

Browse files
committed
Remove nodeToString() support in the Command Triggers API
1 parent d508581 commit 447b88b

File tree

5 files changed

+7
-21
lines changed

5 files changed

+7
-21
lines changed

src/backend/commands/cmdtrigger.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ CreateCmdTrigger(CreateCmdTrigStmt *stmt, const char *queryString)
122122
Relation tgrel;
123123
ListCell *c;
124124
/* cmd trigger args: cmd_string, cmd_nodestring, schemaname, objectname */
125-
Oid fargtypes[5] = {TEXTOID, TEXTOID, TEXTOID, TEXTOID, TEXTOID};
125+
Oid fargtypes[4] = {TEXTOID, TEXTOID, TEXTOID, TEXTOID};
126126
Oid funcoid;
127127
Oid funcrettype;
128128
char ctgtype;
@@ -132,7 +132,7 @@ CreateCmdTrigger(CreateCmdTrigStmt *stmt, const char *queryString)
132132
/*
133133
* Find and validate the trigger function.
134134
*/
135-
funcoid = LookupFuncName(stmt->funcname, 5, fargtypes, false);
135+
funcoid = LookupFuncName(stmt->funcname, 4, fargtypes, false);
136136
funcrettype = get_func_rettype(funcoid);
137137

138138
/*
@@ -614,20 +614,16 @@ call_cmdtrigger_procedure(RegProcedure proc, CommandContext cmd,
614614
if (cmd->cmdstr != NULL)
615615
fcinfo.arg[1] = PointerGetDatum(cstring_to_text(pstrdup(cmd->cmdstr)));
616616

617-
if (cmd->nodestr != NULL)
618-
fcinfo.arg[2] = PointerGetDatum(cstring_to_text(pstrdup(cmd->nodestr)));
619-
620617
if (cmd->schemaname != NULL)
621-
fcinfo.arg[3] = PointerGetDatum(cstring_to_text(pstrdup(cmd->schemaname)));
618+
fcinfo.arg[2] = PointerGetDatum(cstring_to_text(pstrdup(cmd->schemaname)));
622619

623620
if (cmd->objectname != NULL)
624-
fcinfo.arg[4] = PointerGetDatum(cstring_to_text(pstrdup(cmd->objectname)));
621+
fcinfo.arg[3] = PointerGetDatum(cstring_to_text(pstrdup(cmd->objectname)));
625622

626623
fcinfo.argnull[0] = cmd->tag == NULL;
627624
fcinfo.argnull[1] = cmd->cmdstr == NULL;
628-
fcinfo.argnull[2] = cmd->nodestr == NULL;
629-
fcinfo.argnull[3] = cmd->schemaname == NULL;
630-
fcinfo.argnull[4] = cmd->objectname == NULL;
625+
fcinfo.argnull[2] = cmd->schemaname == NULL;
626+
fcinfo.argnull[3] = cmd->objectname == NULL;
631627

632628
pgstat_init_function_usage(&fcinfo, &fcusage);
633629

src/backend/utils/adt/ruleutils.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7940,40 +7940,33 @@ pg_get_cmddef(CommandContext cmd, void *parsetree)
79407940
* firing, in that case we need to avoid trying to fill the CommandContext
79417941
* for command we don't know how to back parse.
79427942
*/
7943-
cmd->nodestr = NULL;
79447943
cmd->objectname = NULL;
79457944
cmd->schemaname = NULL;
79467945

79477946
switch (nodeTag(parsetree))
79487947
{
79497948
case T_DropStmt:
7950-
cmd->nodestr = nodeToString(parsetree);
79517949
_rwDropStmt(cmd, parsetree);
79527950
break;
79537951

79547952
case T_CreateStmt:
7955-
cmd->nodestr = nodeToString(parsetree);
79567953
_rwCreateStmt(cmd, parsetree);
79577954
break;
79587955

79597956
case T_AlterTableStmt:
7960-
cmd->nodestr = nodeToString(parsetree);
79617957
_rwAlterTableStmt(cmd, parsetree);
79627958
break;
79637959

79647960
case T_ViewStmt:
7965-
cmd->nodestr = nodeToString(parsetree);
79667961
_rwViewStmt(cmd, parsetree);
79677962
break;
79687963

79697964
case T_CreateExtensionStmt:
7970-
cmd->nodestr = nodeToString(parsetree);
79717965
_rwCreateExtensionStmt(cmd, parsetree);
79727966
break;
79737967

79747968
default:
7975-
/* is it best to elog(ERROR)? Not while in development :) */
7976-
elog(DEBUG2, "unrecognized node type: %d",
7969+
elog(ERROR, "unrecognized node type: %d",
79777970
(int) nodeTag(parsetree));
79787971
}
79797972
}

src/include/commands/defrem.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ typedef struct CommandContextData
182182
{
183183
char *tag; /* Command Tag */
184184
char *cmdstr; /* Command String, rewritten by ruleutils */
185-
char *nodestr; /* nodeToString(parsetree) */
186185
char *schemaname; /* schemaname or NULL if not relevant */
187186
char *objectname; /* objectname */
188187
} CommandContextData;

src/test/regress/expected/triggers.out

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1447,7 +1447,6 @@ CREATE FUNCTION cmdtrigger_notice
14471447
(
14481448
IN cmd_tag text,
14491449
IN cmd_string text,
1450-
IN cmd_nodestring text,
14511450
IN schemaname text,
14521451
IN relname text
14531452
)

src/test/regress/sql/triggers.sql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,6 @@ CREATE FUNCTION cmdtrigger_notice
966966
(
967967
IN cmd_tag text,
968968
IN cmd_string text,
969-
IN cmd_nodestring text,
970969
IN schemaname text,
971970
IN relname text
972971
)

0 commit comments

Comments
 (0)
0