mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +03:00
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.)
This commit is contained in:
@@ -166,23 +166,6 @@ push @scalar_types, qw(EquivalenceClass* EquivalenceMember*);
|
||||
# currently not required.
|
||||
push @scalar_types, qw(QualCost);
|
||||
|
||||
# XXX various things we are not publishing right now to stay level
|
||||
# with the manual system
|
||||
push @no_read_write,
|
||||
qw(AccessPriv AlterTableCmd CreateOpClassItem FunctionParameter InferClause ObjectWithArgs OnConflictClause PartitionCmd RoleSpec VacuumRelation);
|
||||
push @no_read, qw(A_ArrayExpr A_Indices A_Indirection AlterStatsStmt
|
||||
CollateClause ColumnDef ColumnRef CreateForeignTableStmt CreateStatsStmt
|
||||
CreateStmt FuncCall ImportForeignSchemaStmt IndexElem IndexStmt
|
||||
JsonAggConstructor JsonArgument JsonArrayAgg JsonArrayConstructor
|
||||
JsonArrayQueryConstructor JsonCommon JsonFuncExpr JsonKeyValue
|
||||
JsonObjectAgg JsonObjectConstructor JsonOutput JsonParseExpr JsonScalarExpr
|
||||
JsonSerializeExpr JsonTable JsonTableColumn JsonTablePlan LockingClause
|
||||
MultiAssignRef PLAssignStmt ParamRef PartitionElem PartitionSpec
|
||||
PlaceHolderVar PublicationObjSpec PublicationTable RangeFunction
|
||||
RangeSubselect RangeTableFunc RangeTableFuncCol RangeTableSample RawStmt
|
||||
ResTarget ReturnStmt SelectStmt SortBy StatsElem TableLikeClause
|
||||
TriggerTransition TypeCast TypeName WindowDef WithClause XmlSerialize);
|
||||
|
||||
|
||||
## check that we have the expected number of files on the command line
|
||||
die "wrong number of input files, expected @all_input_files\n"
|
||||
@@ -795,14 +778,6 @@ foreach my $n (@node_types)
|
||||
next if elem $n, @nodetag_only;
|
||||
next if elem $n, @no_read_write;
|
||||
|
||||
# XXX For now, skip all "Stmt"s except that ones that were there before.
|
||||
if ($n =~ /Stmt$/)
|
||||
{
|
||||
my @keep =
|
||||
qw(AlterStatsStmt CreateForeignTableStmt CreateStatsStmt CreateStmt DeclareCursorStmt ImportForeignSchemaStmt IndexStmt NotifyStmt PlannedStmt PLAssignStmt RawStmt ReturnStmt SelectStmt SetOperationStmt);
|
||||
next unless elem $n, @keep;
|
||||
}
|
||||
|
||||
my $no_read = (elem $n, @no_read);
|
||||
|
||||
# output format starts with upper case node type name
|
||||
@@ -827,13 +802,20 @@ _out${n}(StringInfo str, const $n *node)
|
||||
|
||||
";
|
||||
|
||||
print $rff "
|
||||
if (!$no_read)
|
||||
{
|
||||
my $macro =
|
||||
(@{ $node_type_info{$n}->{fields} } > 0)
|
||||
? 'READ_LOCALS'
|
||||
: 'READ_LOCALS_NO_FIELDS';
|
||||
print $rff "
|
||||
static $n *
|
||||
_read${n}(void)
|
||||
{
|
||||
\tREAD_LOCALS($n);
|
||||
\t$macro($n);
|
||||
|
||||
" unless $no_read;
|
||||
";
|
||||
}
|
||||
|
||||
# print instructions for each field
|
||||
foreach my $f (@{ $node_type_info{$n}->{fields} })
|
||||
@@ -883,6 +865,7 @@ _read${n}(void)
|
||||
print $rff "\tREAD_LOCATION_FIELD($f);\n" unless $no_read;
|
||||
}
|
||||
elsif ($t eq 'int'
|
||||
|| $t eq 'int16'
|
||||
|| $t eq 'int32'
|
||||
|| $t eq 'AttrNumber'
|
||||
|| $t eq 'StrategyNumber')
|
||||
|
||||
Reference in New Issue
Block a user