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

Commiteafda78

Browse files
committed
Improve node type forward reference
Instead of using Node *, we can use an incomplete struct. That way,everything has the correct type and fewer casts are required. Thistechnique is already used elsewhere in node type definitions.Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>Reviewed-by: Tender Wang <tndrwang@gmail.com>Discussion:https://www.postgresql.org/message-id/flat/637eeea8-5663-460b-a114-39572c0f6c6e%40eisentraut.org
1 parent41b0239 commiteafda78

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

‎src/backend/commands/createas.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ create_ctas_internal(List *attrList, IntoClause *into)
133133
if (is_matview)
134134
{
135135
/* StoreViewQuery scribbles on tree, so make a copy */
136-
Query*query=(Query*)copyObject(into->viewQuery);
136+
Query*query=copyObject(into->viewQuery);
137137

138138
StoreViewQuery(intoRelationAddr.objectId,query, false);
139139
CommandCounterIncrement();

‎src/backend/parser/analyze.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3077,7 +3077,7 @@ transformCreateTableAsStmt(ParseState *pstate, CreateTableAsStmt *stmt)
30773077
* in the IntoClause because that's where intorel_startup() can
30783078
* conveniently get it from.
30793079
*/
3080-
stmt->into->viewQuery=(Node*)copyObject(query);
3080+
stmt->into->viewQuery=copyObject(query);
30813081
}
30823082

30833083
/* represent the command as a utility Query */

‎src/include/nodes/primnodes.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ typedef struct TableFunc
152152
* For CREATE MATERIALIZED VIEW, viewQuery is the parsed-but-not-rewritten
153153
* SELECT Query for the view; otherwise it's NULL. This is irrelevant in
154154
* the query jumbling as CreateTableAsStmt already includes a reference to
155-
* its own Query, so ignore it. (Although it's actuallyQuery*, we declare
156-
*it as Node* to avoid aforward reference.)
155+
* its own Query, so ignore it. (We declare it as structQuery* to avoid a
156+
* forward reference.)
157157
*/
158158
typedefstructIntoClause
159159
{
@@ -166,7 +166,7 @@ typedef struct IntoClause
166166
OnCommitActiononCommit;/* what do we do at COMMIT? */
167167
char*tableSpaceName;/* table space to use, or NULL */
168168
/* materialized view's SELECT query */
169-
Node*viewQuerypg_node_attr(query_jumble_ignore);
169+
structQuery*viewQuerypg_node_attr(query_jumble_ignore);
170170
boolskipData;/* true for WITH NO DATA */
171171
}IntoClause;
172172

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp