From d4dba501fbf96f7654bc80bf70f24da7c945cb87 Mon Sep 17 00:00:00 2001 From: jian he Date: Wed, 2 Sep 2026 20:36:01 +0900 Subject: [PATCH] Drop the redundant origin and collation marking of a DEFINE clause transformDefineClause() ended by running markTargetListOrigins() and assign_expr_collations() over the DEFINE clause it had just built. Neither does anything the DEFINE clause needs. markTargetListOrigins() fills in resorigtbl and resorigcol, which its header comment says are wanted only for a SELECT targetlist or a RETURNING list, the sole consumer being the RowDescription sent to the frontend. A DEFINE clause is never described to the frontend, both fields are marked query_jumble_ignore, and the readers that are left each work on a query targetlist. assign_expr_collations() is redundant rather than useless. assign_query_collations() runs once transformWindowDefinitions() has returned, and query_tree_walker() reaches wc->defineClause on its own. The call here also handed the whole list to assign_expr_collations(), which infers a single collation across all the members, where a list wants assign_list_collations() -- nothing reaches that today, every DEFINE expression having been coerced to boolean, but it is one more reason not to keep the call. parse_target.h and parse_collate.h go with them. No functional change. --- src/backend/parser/parse_rpr.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/backend/parser/parse_rpr.c b/src/backend/parser/parse_rpr.c index 2d058e63bf5..02be3370fff 100644 --- a/src/backend/parser/parse_rpr.c +++ b/src/backend/parser/parse_rpr.c @@ -29,10 +29,8 @@ #include "optimizer/optimizer.h" #include "optimizer/rpr.h" #include "parser/parse_coerce.h" -#include "parser/parse_collate.h" #include "parser/parse_expr.h" #include "parser/parse_rpr.h" -#include "parser/parse_target.h" /* DEFINE clause walker context -- see define_walker for usage. */ typedef enum @@ -414,12 +412,6 @@ transformDefineClause(ParseState *pstate, WindowDef *windef, (void) define_walker((Node *) te->expr, &ctx); } - /* mark column origins */ - markTargetListOrigins(pstate, defineClause); - - /* mark all nodes in the DEFINE clause tree with collation information */ - assign_expr_collations(pstate, (Node *) defineClause); - return defineClause; }