Improve node type forward reference
Peter Eisentraut <peter@eisentraut.org>
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2024-10-14T07:47:59Z
Lists: pgsql-hackers
Attachments
- 0001-Improve-node-type-forward-reference.patch (text/plain) patch 0001
- 0002-Fix-unnecessary-casts-of-copyObject-result.patch (text/plain) patch 0002
This is a small code simplification.
In primnodes.h, we have
typedef struct IntoClause
{
...
/* materialized view's SELECT query */
Node *viewQuery ...;
with the comment
/* (Although it's actually Query*, we declare
* it as Node* to avoid a forward reference.)
But we can do this better by using an incomplete struct, like
struct Query *viewQuery ...;
That way, everything has the correct type and fewer casts are required.
This technique is already used elsewhere in node type definitions.
The second patch just removes some more unnecessary casts around
copyObject() that I found while working on this.
Commits
-
Fix unnecessary casts of copyObject() result
- 665785d85f8b 18.0 landed
-
Improve node type forward reference
- eafda78fc404 18.0 landed