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

Commitd69cd3a

Browse files
committed
Ignore IntoClause.viewQuery in query jumbling
IntoClause.viewQuery is a copy of the parsed-but-not-rewritten SELECTclause copied to IntoClause when transforming CreateTableAsStmt for amaterialized view. Including a second copy of the SELECT Query into thequery jumbling was leading to an incorrect numbering of the Const nodelocations, as these would be counted twice instead of once.This becomes visible once the query normalization is applied to CREATEMATERIALIZED VIEW in pg_stat_statements in the shape of a query stringusing only odd numbers for the normalized constants, (regression testsadded in pg_stat_statements as ofde2aca2 would show the difference).Including the original Query from CreateTableAsStmt is enough for thequery jumbling.Reviewed-by: Bertrand DrouvotDiscussion:https://postgr.es/m/Y+MRdEq9W9XVa2AB@paquier.xyz
1 parentee56048 commitd69cd3a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

‎src/include/nodes/primnodes.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,10 @@ typedef struct TableFunc
128128
* CREATE MATERIALIZED VIEW
129129
*
130130
* For CREATE MATERIALIZED VIEW, viewQuery is the parsed-but-not-rewritten
131-
* SELECT Query for the view; otherwise it's NULL. (Although it's actually
132-
* Query*, we declare it as Node* to avoid a forward reference.)
131+
* SELECT Query for the view; otherwise it's NULL. This is irrelevant in
132+
* the query jumbling as CreateTableAsStmt already includes a reference to
133+
* its own Query, so ignore it. (Although it's actually Query*, we declare
134+
* it as Node* to avoid a forward reference.)
133135
*/
134136
typedefstructIntoClause
135137
{
@@ -141,7 +143,8 @@ typedef struct IntoClause
141143
List*options;/* options from WITH clause */
142144
OnCommitActiononCommit;/* what do we do at COMMIT? */
143145
char*tableSpaceName;/* table space to use, or NULL */
144-
Node*viewQuery;/* materialized view's SELECT query */
146+
/* materialized view's SELECT query */
147+
Node*viewQuerypg_node_attr(query_jumble_ignore);
145148
boolskipData;/* true for WITH NO DATA */
146149
}IntoClause;
147150

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp