1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-04 20:11:56 +03:00

gen_node_support.pl: Mark location fields as type alias ParseLoc

Instead of the rather ugly type=int + name ~= location$, we now have a
marker type for offset pointers or sizes that are only relevant when a
query text is included, which decreases the complexity required in
gen_node_support.pl for handling these values.

Author: Matthias van de Meent <boekewurm+postgres@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CAEze2WgrCiR3JZmWyB0YTc8HV7ewRdx13j0CqD6mVkYAW+SFGQ@mail.gmail.com
This commit is contained in:
Peter Eisentraut
2024-03-19 16:55:00 +01:00
parent 347758b120
commit 605721f819
6 changed files with 97 additions and 87 deletions

View File

@@ -777,7 +777,7 @@ _equal${n}(const $n *a, const $n *b)
print $eff "\tCOMPARE_BITMAPSET_FIELD($f);\n"
unless $equal_ignore;
}
elsif ($t eq 'int' && $f =~ 'location$')
elsif ($t eq 'ParseLoc')
{
print $cff "\tCOPY_LOCATION_FIELD($f);\n" unless $copy_ignore;
print $eff "\tCOMPARE_LOCATION_FIELD($f);\n" unless $equal_ignore;
@@ -1010,7 +1010,7 @@ _read${n}(void)
print $off "\tWRITE_BOOL_FIELD($f);\n";
print $rff "\tREAD_BOOL_FIELD($f);\n" unless $no_read;
}
elsif ($t eq 'int' && $f =~ 'location$')
elsif ($t eq 'ParseLoc')
{
print $off "\tWRITE_LOCATION_FIELD($f);\n";
print $rff "\tREAD_LOCATION_FIELD($f);\n" unless $no_read;
@@ -1303,7 +1303,7 @@ _jumble${n}(JumbleState *jstate, Node *node)
print $jff "\tJUMBLE_NODE($f);\n"
unless $query_jumble_ignore;
}
elsif ($t eq 'int' && $f =~ 'location$')
elsif ($t eq 'ParseLoc')
{
# Track the node's location only if directly requested.
if ($query_jumble_location)