Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2a507f6

Browse files
committed
Mark more nodes with attribute no_query_jumble
This commit removes most of the Plan and Path nodes, which should neverbe included in the query jumbling because we ignore these in Querynodes. This is facilitated by making no_query_jumble an inheritedattribute, like no_copy, no_equal and no_read when the supertype of anode is found as marked with that.RawStmt is not used in parsed queries, so it can be removed from thequery jumbling. A couple of nodes defined in pathnodes.h, plannodes.hand primnodes.h with NodeTag as supertype need to be markedindividually.Forcing the execution of the query jumbling code with compute_query_id =auto while pg_stat_statements is loaded brings the code coverage ofqueryjumblefuncs.funcs.c to 95.6%.The core code does not yet include a way to enforce the execution inquery jumbling except in pg_stat_statements, so the numbers I ammentioning above will not reflect on the default coverage report withjust what is done in this commit.Reported-by: Tom LaneReviewed-by: Tom LaneDiscussion:https://postgr.es/m/3344827.1675809127@sss.pgh.pa.us
1 parent6ded4a5 commit2a507f6

File tree

7 files changed

+54
-39
lines changed

7 files changed

+54
-39
lines changed

‎src/backend/nodes/gen_node_support.pl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ sub elem
121121
my@no_copy;
122122
# node types we don't want equal support for
123123
my@no_equal;
124-
# node types we don't want jumble support for
124+
# node types we don't wantqueryjumble support for
125125
my@no_query_jumble;
126126
# node types we don't want read support for
127127
my@no_read;
@@ -422,6 +422,8 @@ sub elem
422422
if elem$supertype,@no_equal;
423423
push@no_read,$in_struct
424424
if elem$supertype,@no_read;
425+
push@no_query_jumble,$in_struct
426+
if elem$supertype,@no_query_jumble;
425427
}
426428
}
427429

‎src/include/nodes/nodes.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ typedef enum NodeTag
7777
*
7878
* Node types can be supertypes of other types whether or not they are marked
7979
* abstract: if a node struct appears as the first field of another struct
80-
* type, then it is the supertype of that type. The no_copy, no_equal, and
81-
* no_read node attributes are automatically inherited from the supertype.
82-
* (Notice that nodetag_only does not inherit, so it's not quite equivalent
83-
* to a combination of other attributes.)
80+
* type, then it is the supertype of that type. The no_copy, no_equal,
81+
*no_query_jumble andno_read node attributes are automatically inherited
82+
*from the supertype.(Notice that nodetag_only does not inherit, so it's
83+
*not quite equivalentto a combination of other attributes.)
8484
*
8585
* Valid node field attributes:
8686
*

‎src/include/nodes/parsenodes.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1728,9 +1728,14 @@ typedef struct TriggerTransition
17281728
*
17291729
* stmt_location/stmt_len identify the portion of the source text string
17301730
* containing this raw statement (useful for multi-statement strings).
1731+
*
1732+
* This is irrelevant for query jumbling, as this is not used in parsed
1733+
* queries.
17311734
*/
17321735
typedefstructRawStmt
17331736
{
1737+
pg_node_attr(no_query_jumble)
1738+
17341739
NodeTagtype;
17351740
Node*stmt;/* raw parse tree */
17361741
intstmt_location;/* start location, or -1 if unknown */

‎src/include/nodes/pathnodes.h

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ typedef enum UpperRelationKind
9494
*/
9595
typedefstructPlannerGlobal
9696
{
97-
pg_node_attr(no_copy_equal,no_read)
97+
pg_node_attr(no_copy_equal,no_read,no_query_jumble)
9898

9999
NodeTagtype;
100100

@@ -194,7 +194,7 @@ typedef struct PlannerInfo PlannerInfo;
194194

195195
structPlannerInfo
196196
{
197-
pg_node_attr(no_copy_equal,no_read)
197+
pg_node_attr(no_copy_equal,no_read,no_query_jumble)
198198

199199
NodeTagtype;
200200

@@ -853,7 +853,7 @@ typedef enum RelOptKind
853853

854854
typedefstructRelOptInfo
855855
{
856-
pg_node_attr(no_copy_equal,no_read)
856+
pg_node_attr(no_copy_equal,no_read,no_query_jumble)
857857

858858
NodeTagtype;
859859

@@ -1098,7 +1098,7 @@ typedef struct IndexOptInfo IndexOptInfo;
10981098

10991099
structIndexOptInfo
11001100
{
1101-
pg_node_attr(no_copy_equal,no_read)
1101+
pg_node_attr(no_copy_equal,no_read,no_query_jumble)
11021102

11031103
NodeTagtype;
11041104

@@ -1208,7 +1208,7 @@ struct IndexOptInfo
12081208
*/
12091209
typedefstructForeignKeyOptInfo
12101210
{
1211-
pg_node_attr(custom_read_write,no_copy_equal,no_read)
1211+
pg_node_attr(custom_read_write,no_copy_equal,no_read,no_query_jumble)
12121212

12131213
NodeTagtype;
12141214

@@ -1258,7 +1258,7 @@ typedef struct ForeignKeyOptInfo
12581258
*/
12591259
typedefstructStatisticExtInfo
12601260
{
1261-
pg_node_attr(no_copy_equal,no_read)
1261+
pg_node_attr(no_copy_equal,no_read,no_query_jumble)
12621262

12631263
NodeTagtype;
12641264

@@ -1309,7 +1309,7 @@ typedef struct StatisticExtInfo
13091309
*/
13101310
typedefstructJoinDomain
13111311
{
1312-
pg_node_attr(no_copy_equal,no_read)
1312+
pg_node_attr(no_copy_equal,no_read,no_query_jumble)
13131313

13141314
NodeTagtype;
13151315

@@ -1371,7 +1371,7 @@ typedef struct JoinDomain
13711371
*/
13721372
typedefstructEquivalenceClass
13731373
{
1374-
pg_node_attr(custom_read_write,no_copy_equal,no_read)
1374+
pg_node_attr(custom_read_write,no_copy_equal,no_read,no_query_jumble)
13751375

13761376
NodeTagtype;
13771377

@@ -1422,7 +1422,7 @@ typedef struct EquivalenceClass
14221422
*/
14231423
typedefstructEquivalenceMember
14241424
{
1425-
pg_node_attr(no_copy_equal,no_read)
1425+
pg_node_attr(no_copy_equal,no_read,no_query_jumble)
14261426

14271427
NodeTagtype;
14281428

@@ -1455,7 +1455,7 @@ typedef struct EquivalenceMember
14551455
*/
14561456
typedefstructPathKey
14571457
{
1458-
pg_node_attr(no_read)
1458+
pg_node_attr(no_read,no_query_jumble)
14591459

14601460
NodeTagtype;
14611461

@@ -1503,7 +1503,7 @@ typedef enum VolatileFunctionStatus
15031503
*/
15041504
typedefstructPathTarget
15051505
{
1506-
pg_node_attr(no_copy_equal,no_read)
1506+
pg_node_attr(no_copy_equal,no_read,no_query_jumble)
15071507

15081508
NodeTagtype;
15091509

@@ -1550,7 +1550,7 @@ typedef struct PathTarget
15501550
*/
15511551
typedefstructParamPathInfo
15521552
{
1553-
pg_node_attr(no_copy_equal,no_read)
1553+
pg_node_attr(no_copy_equal,no_read,no_query_jumble)
15541554

15551555
NodeTagtype;
15561556

@@ -1596,7 +1596,7 @@ typedef struct ParamPathInfo
15961596
*/
15971597
typedefstructPath
15981598
{
1599-
pg_node_attr(no_copy_equal,no_read)
1599+
pg_node_attr(no_copy_equal,no_read,no_query_jumble)
16001600

16011601
NodeTagtype;
16021602

@@ -1730,7 +1730,7 @@ typedef struct IndexPath
17301730
*/
17311731
typedefstructIndexClause
17321732
{
1733-
pg_node_attr(no_copy_equal,no_read)
1733+
pg_node_attr(no_copy_equal,no_read,no_query_jumble)
17341734

17351735
NodeTagtype;
17361736
structRestrictInfo*rinfo;/* original restriction or join clause */
@@ -2231,7 +2231,7 @@ typedef struct AggPath
22312231

22322232
typedefstructGroupingSetData
22332233
{
2234-
pg_node_attr(no_copy_equal,no_read)
2234+
pg_node_attr(no_copy_equal,no_read,no_query_jumble)
22352235

22362236
NodeTagtype;
22372237
List*set;/* grouping set as list of sortgrouprefs */
@@ -2240,7 +2240,7 @@ typedef struct GroupingSetData
22402240

22412241
typedefstructRollupData
22422242
{
2243-
pg_node_attr(no_copy_equal,no_read)
2243+
pg_node_attr(no_copy_equal,no_read,no_query_jumble)
22442244

22452245
NodeTagtype;
22462246
List*groupClause;/* applicable subset of parse->groupClause */
@@ -2509,7 +2509,7 @@ typedef struct LimitPath
25092509

25102510
typedefstructRestrictInfo
25112511
{
2512-
pg_node_attr(no_read)
2512+
pg_node_attr(no_read,no_query_jumble)
25132513

25142514
NodeTagtype;
25152515

@@ -2724,6 +2724,8 @@ typedef struct MergeScanSelCache
27242724

27252725
typedefstructPlaceHolderVar
27262726
{
2727+
pg_node_attr(no_query_jumble)
2728+
27272729
Exprxpr;
27282730

27292731
/* the represented expression */
@@ -2825,7 +2827,7 @@ typedef struct SpecialJoinInfo SpecialJoinInfo;
28252827

28262828
structSpecialJoinInfo
28272829
{
2828-
pg_node_attr(no_read)
2830+
pg_node_attr(no_read,no_query_jumble)
28292831

28302832
NodeTagtype;
28312833
Relidsmin_lefthand;/* base+OJ relids in minimum LHS for join */
@@ -2853,7 +2855,7 @@ struct SpecialJoinInfo
28532855
*/
28542856
typedefstructOuterJoinClauseInfo
28552857
{
2856-
pg_node_attr(no_copy_equal,no_read)
2858+
pg_node_attr(no_copy_equal,no_read,no_query_jumble)
28572859

28582860
NodeTagtype;
28592861
RestrictInfo*rinfo;/* a mergejoinable outer-join clause */
@@ -2892,6 +2894,8 @@ typedef struct OuterJoinClauseInfo
28922894

28932895
typedefstructAppendRelInfo
28942896
{
2897+
pg_node_attr(no_query_jumble)
2898+
28952899
NodeTagtype;
28962900

28972901
/*
@@ -2967,7 +2971,7 @@ typedef struct AppendRelInfo
29672971
*/
29682972
typedefstructRowIdentityVarInfo
29692973
{
2970-
pg_node_attr(no_copy_equal,no_read)
2974+
pg_node_attr(no_copy_equal,no_read,no_query_jumble)
29712975

29722976
NodeTagtype;
29732977

@@ -3005,7 +3009,7 @@ typedef struct RowIdentityVarInfo
30053009

30063010
typedefstructPlaceHolderInfo
30073011
{
3008-
pg_node_attr(no_read)
3012+
pg_node_attr(no_read,no_query_jumble)
30093013

30103014
NodeTagtype;
30113015

@@ -3038,7 +3042,7 @@ typedef struct PlaceHolderInfo
30383042
*/
30393043
typedefstructMinMaxAggInfo
30403044
{
3041-
pg_node_attr(no_copy_equal,no_read)
3045+
pg_node_attr(no_copy_equal,no_read,no_query_jumble)
30423046

30433047
NodeTagtype;
30443048

@@ -3116,7 +3120,7 @@ typedef struct MinMaxAggInfo
31163120
*/
31173121
typedefstructPlannerParamItem
31183122
{
3119-
pg_node_attr(no_copy_equal,no_read)
3123+
pg_node_attr(no_copy_equal,no_read,no_query_jumble)
31203124

31213125
NodeTagtype;
31223126

@@ -3296,7 +3300,7 @@ typedef struct JoinCostWorkspace
32963300
*/
32973301
typedefstructAggInfo
32983302
{
3299-
pg_node_attr(no_copy_equal,no_read)
3303+
pg_node_attr(no_copy_equal,no_read,no_query_jumble)
33003304

33013305
NodeTagtype;
33023306

@@ -3330,7 +3334,7 @@ typedef struct AggInfo
33303334
*/
33313335
typedefstructAggTransInfo
33323336
{
3333-
pg_node_attr(no_copy_equal,no_read)
3337+
pg_node_attr(no_copy_equal,no_read,no_query_jumble)
33343338

33353339
NodeTagtype;
33363340

‎src/include/nodes/plannodes.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
*/
4747
typedefstructPlannedStmt
4848
{
49-
pg_node_attr(no_equal)
49+
pg_node_attr(no_equal,no_query_jumble)
5050

5151
NodeTagtype;
5252

@@ -122,7 +122,7 @@ typedef struct PlannedStmt
122122
*/
123123
typedefstructPlan
124124
{
125-
pg_node_attr(abstract,no_equal)
125+
pg_node_attr(abstract,no_equal,no_query_jumble)
126126

127127
NodeTagtype;
128128

@@ -813,7 +813,7 @@ typedef struct NestLoop
813813

814814
typedefstructNestLoopParam
815815
{
816-
pg_node_attr(no_equal)
816+
pg_node_attr(no_equal,no_query_jumble)
817817

818818
NodeTagtype;
819819
intparamno;/* number of the PARAM_EXEC Param to set */
@@ -1377,7 +1377,7 @@ typedef enum RowMarkType
13771377
*/
13781378
typedefstructPlanRowMark
13791379
{
1380-
pg_node_attr(no_equal)
1380+
pg_node_attr(no_equal,no_query_jumble)
13811381

13821382
NodeTagtype;
13831383
Indexrti;/* range table index of markable relation */
@@ -1425,7 +1425,7 @@ typedef struct PlanRowMark
14251425
*/
14261426
typedefstructPartitionPruneInfo
14271427
{
1428-
pg_node_attr(no_equal)
1428+
pg_node_attr(no_equal,no_query_jumble)
14291429

14301430
NodeTagtype;
14311431
Bitmapset*root_parent_relids;
@@ -1452,7 +1452,7 @@ typedef struct PartitionPruneInfo
14521452
*/
14531453
typedefstructPartitionedRelPruneInfo
14541454
{
1455-
pg_node_attr(no_equal)
1455+
pg_node_attr(no_equal,no_query_jumble)
14561456

14571457
NodeTagtype;
14581458

@@ -1495,7 +1495,7 @@ typedef struct PartitionedRelPruneInfo
14951495
*/
14961496
typedefstructPartitionPruneStep
14971497
{
1498-
pg_node_attr(abstract,no_equal)
1498+
pg_node_attr(abstract,no_equal,no_query_jumble)
14991499

15001500
NodeTagtype;
15011501
intstep_id;
@@ -1570,7 +1570,7 @@ typedef struct PartitionPruneStepCombine
15701570
*/
15711571
typedefstructPlanInvalItem
15721572
{
1573-
pg_node_attr(no_equal)
1573+
pg_node_attr(no_equal,no_query_jumble)
15741574

15751575
NodeTagtype;
15761576
intcacheId;/* a syscache ID, see utils/syscache.h */

‎src/include/nodes/primnodes.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -982,6 +982,8 @@ typedef struct SubLink
982982
*/
983983
typedefstructSubPlan
984984
{
985+
pg_node_attr(no_query_jumble)
986+
985987
Exprxpr;
986988
/* Fields copied from original SubLink: */
987989
SubLinkTypesubLinkType;/* see above */
@@ -1029,6 +1031,8 @@ typedef struct SubPlan
10291031
*/
10301032
typedefstructAlternativeSubPlan
10311033
{
1034+
pg_node_attr(no_query_jumble)
1035+
10321036
Exprxpr;
10331037
List*subplans;/* SubPlan(s) with equivalent results */
10341038
}AlternativeSubPlan;

‎src/include/utils/rel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ typedef struct RelationData
268268
*/
269269
typedefstructForeignKeyCacheInfo
270270
{
271-
pg_node_attr(no_equal,no_read)
271+
pg_node_attr(no_equal,no_read,no_query_jumble)
272272

273273
NodeTagtype;
274274
/* oid of the constraint itself */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp