summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2022-07-12 10:46:58 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2022-07-12 10:46:58 -0400
commitca187d7455f174da40e26e6e0c8361821ee19559 (patch)
tree39b1e3521ca333d9d2a8c7b1d8b43131ed1d6979 /src/include
parent09c5acee8ef90a9a94993dad937bdcd56ccaf1e3 (diff)
Invent nodetag_only attribute for Nodes.
This allows explaining gen_node_support.pl's handling of execnodes.h and some other input files as being a shortcut for explicit marking of all their node declarations as pg_node_attr(nodetag_only). I foresee that someday we might need to be more fine-grained about that, and this change provides the infrastructure needed to do so. For now, it just allows removal of the script's klugy special case for CallContext and InlineCodeBlock. Discussion: https://postgr.es/m/75063.1657410615@sss.pgh.pa.us
Diffstat (limited to 'src/include')
-rw-r--r--src/include/nodes/nodes.h5
-rw-r--r--src/include/nodes/parsenodes.h4
2 files changed, 9 insertions, 0 deletions
diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h
index adc549002a6..c8ed4e05524 100644
--- a/src/include/nodes/nodes.h
+++ b/src/include/nodes/nodes.h
@@ -61,12 +61,17 @@ typedef enum NodeTag
*
* - no_read: Does not support nodeRead() at all.
*
+ * - nodetag_only: Does not support copyObject(), equal(), outNode(),
+ * or nodeRead().
+ *
* - special_read_write: Has special treatment in outNode() and nodeRead().
*
* Node types can be supertypes of other types whether or not they are marked
* abstract: if a node struct appears as the first field of another struct
* type, then it is the supertype of that type. The no_copy, no_equal, and
* no_read node attributes are automatically inherited from the supertype.
+ * (Notice that nodetag_only does not inherit, so it's not quite equivalent
+ * to a combination of other attributes.)
*
* Valid node field attributes:
*
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index 0b6a7bb3650..e2ad7617685 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -3382,6 +3382,8 @@ typedef struct DoStmt
typedef struct InlineCodeBlock
{
+ pg_node_attr(nodetag_only) /* this is not a member of parse trees */
+
NodeTag type;
char *source_text; /* source text of anonymous code block */
Oid langOid; /* OID of selected language */
@@ -3408,6 +3410,8 @@ typedef struct CallStmt
typedef struct CallContext
{
+ pg_node_attr(nodetag_only) /* this is not a member of parse trees */
+
NodeTag type;
bool atomic;
} CallContext;