Skip to content

Commit 367c989

Browse files
committed
Remove custom _jumbleRangeTblEntry()
This is part of an effort to reduce the number of special cases in the automatically generated node support functions. This patch removes _jumbleRangeTblEntry() and instead adds per-field query_jumble_ignore annotations to match the behavior of the previous custom code. The pg_stat_statements test suite has some coverage of this. It gets rid of the switch on rtekind; this should be technically correct, since we do the equal and copy functions like this also. The list of fields to jumble has been checked and is considered correct as of 8b29a11. Reviewed-by: Andrew Dunstan <andrew@dunslane.net> Discussion: https://www.postgresql.org/message-id/flat/4b27fc50-8cd6-46f5-ab20-88dbaadca645@eisentraut.org
1 parent d575051 commit 367c989

File tree

2 files changed

+20
-69
lines changed

2 files changed

+20
-69
lines changed

src/backend/nodes/queryjumblefuncs.c

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -353,52 +353,3 @@ _jumbleA_Const(JumbleState *jstate, Node *node)
353353
}
354354
}
355355
}
356-
357-
static void
358-
_jumbleRangeTblEntry(JumbleState *jstate, Node *node)
359-
{
360-
RangeTblEntry *expr = (RangeTblEntry *) node;
361-
362-
JUMBLE_FIELD(rtekind);
363-
switch (expr->rtekind)
364-
{
365-
case RTE_RELATION:
366-
JUMBLE_FIELD(relid);
367-
JUMBLE_FIELD(inh);
368-
JUMBLE_NODE(tablesample);
369-
break;
370-
case RTE_SUBQUERY:
371-
JUMBLE_NODE(subquery);
372-
break;
373-
case RTE_JOIN:
374-
JUMBLE_FIELD(jointype);
375-
break;
376-
case RTE_FUNCTION:
377-
JUMBLE_NODE(functions);
378-
JUMBLE_FIELD(funcordinality);
379-
break;
380-
case RTE_TABLEFUNC:
381-
JUMBLE_NODE(tablefunc);
382-
break;
383-
case RTE_VALUES:
384-
JUMBLE_NODE(values_lists);
385-
break;
386-
case RTE_CTE:
387-
388-
/*
389-
* Depending on the CTE name here isn't ideal, but it's the only
390-
* info we have to identify the referenced WITH item.
391-
*/
392-
JUMBLE_STRING(ctename);
393-
JUMBLE_FIELD(ctelevelsup);
394-
break;
395-
case RTE_NAMEDTUPLESTORE:
396-
JUMBLE_STRING(enrname);
397-
break;
398-
case RTE_RESULT:
399-
break;
400-
default:
401-
elog(ERROR, "unrecognized RTE kind: %d", (int) expr->rtekind);
402-
break;
403-
}
404-
}

src/include/nodes/parsenodes.h

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,7 @@ typedef enum RTEKind
10231023

10241024
typedef struct RangeTblEntry
10251025
{
1026-
pg_node_attr(custom_read_write, custom_query_jumble)
1026+
pg_node_attr(custom_read_write)
10271027

10281028
NodeTag type;
10291029

@@ -1072,11 +1072,11 @@ typedef struct RangeTblEntry
10721072
/* inheritance requested? */
10731073
bool inh;
10741074
/* relation kind (see pg_class.relkind) */
1075-
char relkind;
1075+
char relkind pg_node_attr(query_jumble_ignore);
10761076
/* lock level that query requires on the rel */
1077-
int rellockmode;
1077+
int rellockmode pg_node_attr(query_jumble_ignore);
10781078
/* index of RTEPermissionInfo entry, or 0 */
1079-
Index perminfoindex;
1079+
Index perminfoindex pg_node_attr(query_jumble_ignore);
10801080
/* sampling info, or NULL */
10811081
struct TableSampleClause *tablesample;
10821082

@@ -1086,7 +1086,7 @@ typedef struct RangeTblEntry
10861086
/* the sub-query */
10871087
Query *subquery;
10881088
/* is from security_barrier view? */
1089-
bool security_barrier;
1089+
bool security_barrier pg_node_attr(query_jumble_ignore);
10901090

10911091
/*
10921092
* Fields valid for a join RTE (else NULL/zero):
@@ -1133,20 +1133,20 @@ typedef struct RangeTblEntry
11331133
*/
11341134
JoinType jointype;
11351135
/* number of merged (JOIN USING) columns */
1136-
int joinmergedcols;
1136+
int joinmergedcols pg_node_attr(query_jumble_ignore);
11371137
/* list of alias-var expansions */
1138-
List *joinaliasvars;
1138+
List *joinaliasvars pg_node_attr(query_jumble_ignore);
11391139
/* left-side input column numbers */
1140-
List *joinleftcols;
1140+
List *joinleftcols pg_node_attr(query_jumble_ignore);
11411141
/* right-side input column numbers */
1142-
List *joinrightcols;
1142+
List *joinrightcols pg_node_attr(query_jumble_ignore);
11431143

11441144
/*
11451145
* join_using_alias is an alias clause attached directly to JOIN/USING. It
11461146
* is different from the alias field (below) in that it does not hide the
11471147
* range variables of the tables being joined.
11481148
*/
1149-
Alias *join_using_alias;
1149+
Alias *join_using_alias pg_node_attr(query_jumble_ignore);
11501150

11511151
/*
11521152
* Fields valid for a function RTE (else NIL/zero):
@@ -1180,7 +1180,7 @@ typedef struct RangeTblEntry
11801180
/* number of query levels up */
11811181
Index ctelevelsup;
11821182
/* is this a recursive self-reference? */
1183-
bool self_reference;
1183+
bool self_reference pg_node_attr(query_jumble_ignore);
11841184

11851185
/*
11861186
* Fields valid for CTE, VALUES, ENR, and TableFunc RTEs (else NIL):
@@ -1201,33 +1201,33 @@ typedef struct RangeTblEntry
12011201
* for zero coltype is the standard way to detect a dropped column.
12021202
*/
12031203
/* OID list of column type OIDs */
1204-
List *coltypes;
1204+
List *coltypes pg_node_attr(query_jumble_ignore);
12051205
/* integer list of column typmods */
1206-
List *coltypmods;
1206+
List *coltypmods pg_node_attr(query_jumble_ignore);
12071207
/* OID list of column collation OIDs */
1208-
List *colcollations;
1208+
List *colcollations pg_node_attr(query_jumble_ignore);
12091209

12101210
/*
12111211
* Fields valid for ENR RTEs (else NULL/zero):
12121212
*/
12131213
/* name of ephemeral named relation */
12141214
char *enrname;
12151215
/* estimated or actual from caller */
1216-
Cardinality enrtuples;
1216+
Cardinality enrtuples pg_node_attr(query_jumble_ignore);
12171217

12181218
/*
12191219
* Fields valid in all RTEs:
12201220
*/
12211221
/* user-written alias clause, if any */
1222-
Alias *alias;
1222+
Alias *alias pg_node_attr(query_jumble_ignore);
12231223
/* expanded reference names */
1224-
Alias *eref;
1224+
Alias *eref pg_node_attr(query_jumble_ignore);
12251225
/* was LATERAL specified? */
1226-
bool lateral;
1226+
bool lateral pg_node_attr(query_jumble_ignore);
12271227
/* present in FROM clause? */
1228-
bool inFromCl;
1228+
bool inFromCl pg_node_attr(query_jumble_ignore);
12291229
/* security barrier quals to apply, if any */
1230-
List *securityQuals;
1230+
List *securityQuals pg_node_attr(query_jumble_ignore);
12311231
} RangeTblEntry;
12321232

12331233
/*

0 commit comments

Comments
 (0)