diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2022-07-13 11:48:17 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2022-07-13 11:48:17 -0400 |
commit | ff33a8c8874b43ec55d517ce0612ed79ad08a38a (patch) | |
tree | 9ca6ab1de358c7d9aefebc4df78c24c05c83f958 /src/backend/nodes/outfuncs.c | |
parent | 9c727360bcc77cf88693129cd6e610b752fdd3d1 (diff) | |
download | postgresql-ff33a8c8874b43ec55d517ce0612ed79ad08a38a.tar.gz postgresql-ff33a8c8874b43ec55d517ce0612ed79ad08a38a.zip |
Remove artificial restrictions on which node types have out/read funcs.
The initial version of gen_node_support.pl manually excluded most
utility statement node types from having out/read support, and
also some raw-parse-tree-only node types. That was mostly to keep
the output comparable to the old hand-maintained code. We'd like
to have out/read support for utility statements, for debugging
purposes and so that they can be included in new-style SQL functions;
so it's time to lift that restriction.
Most if not all of the previously-excluded raw-parse-tree-only node
types can appear in expression subtrees of utility statements, so
they have to be handled too.
We don't quite have full read support yet; certain custom_read_write
node types need to have their handwritten read functions implemented
before that will work.
Doing this allows us to drop the previous hack in _outQuery to not
dump the utilityStmt field in most cases, which means we no longer
need manually-maintained out/read functions for Query, so get rid
of those in favor of auto-generating them.
Fix a couple of omissions in gen_node_support.pl that are exposed
through having to handle more node types.
catversion bump forced because somebody was sloppy about the field
order in the manually-maintained Query out/read functions.
(Committers should note that almost all changes in parsenodes.h
are now grounds for a catversion bump.)
Diffstat (limited to 'src/backend/nodes/outfuncs.c')
-rw-r--r-- | src/backend/nodes/outfuncs.c | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index 9e43fec86d4..2b85f97f398 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -416,79 +416,6 @@ _outExtensibleNode(StringInfo str, const ExtensibleNode *node) } static void -_outQuery(StringInfo str, const Query *node) -{ - WRITE_NODE_TYPE("QUERY"); - - WRITE_ENUM_FIELD(commandType, CmdType); - WRITE_ENUM_FIELD(querySource, QuerySource); - /* we intentionally do not print the queryId field */ - WRITE_BOOL_FIELD(canSetTag); - - /* - * Hack to work around missing outfuncs routines for a lot of the - * utility-statement node types. (The only one we actually *need* for - * rules support is NotifyStmt.) Someday we ought to support 'em all, but - * for the meantime do this to avoid getting lots of warnings when running - * with debug_print_parse on. - */ - if (node->utilityStmt) - { - switch (nodeTag(node->utilityStmt)) - { - case T_CreateStmt: - case T_IndexStmt: - case T_NotifyStmt: - case T_DeclareCursorStmt: - WRITE_NODE_FIELD(utilityStmt); - break; - default: - appendStringInfoString(str, " :utilityStmt ?"); - break; - } - } - else - appendStringInfoString(str, " :utilityStmt <>"); - - WRITE_INT_FIELD(resultRelation); - WRITE_BOOL_FIELD(hasAggs); - WRITE_BOOL_FIELD(hasWindowFuncs); - WRITE_BOOL_FIELD(hasTargetSRFs); - WRITE_BOOL_FIELD(hasSubLinks); - WRITE_BOOL_FIELD(hasDistinctOn); - WRITE_BOOL_FIELD(hasRecursive); - WRITE_BOOL_FIELD(hasModifyingCTE); - WRITE_BOOL_FIELD(hasForUpdate); - WRITE_BOOL_FIELD(hasRowSecurity); - WRITE_BOOL_FIELD(isReturn); - WRITE_NODE_FIELD(cteList); - WRITE_NODE_FIELD(rtable); - WRITE_NODE_FIELD(jointree); - WRITE_NODE_FIELD(targetList); - WRITE_ENUM_FIELD(override, OverridingKind); - WRITE_NODE_FIELD(onConflict); - WRITE_NODE_FIELD(returningList); - WRITE_NODE_FIELD(groupClause); - WRITE_BOOL_FIELD(groupDistinct); - WRITE_NODE_FIELD(groupingSets); - WRITE_NODE_FIELD(havingQual); - WRITE_NODE_FIELD(windowClause); - WRITE_NODE_FIELD(distinctClause); - WRITE_NODE_FIELD(sortClause); - WRITE_NODE_FIELD(limitOffset); - WRITE_NODE_FIELD(limitCount); - WRITE_ENUM_FIELD(limitOption, LimitOption); - WRITE_NODE_FIELD(rowMarks); - WRITE_NODE_FIELD(setOperations); - WRITE_NODE_FIELD(constraintDeps); - WRITE_NODE_FIELD(withCheckOptions); - WRITE_NODE_FIELD(mergeActionList); - WRITE_BOOL_FIELD(mergeUseOuterJoin); - WRITE_LOCATION_FIELD(stmt_location); - WRITE_INT_FIELD(stmt_len); -} - -static void _outRangeTblEntry(StringInfo str, const RangeTblEntry *node) { WRITE_NODE_TYPE("RANGETBLENTRY"); |