Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 605721f

Browse filesBrowse files
committed
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
1 parent 347758b commit 605721f
Copy full SHA for 605721f

File tree

Expand file treeCollapse file tree

6 files changed

+97
-87
lines changed
Filter options
Expand file treeCollapse file tree

6 files changed

+97
-87
lines changed

‎src/backend/nodes/gen_node_support.pl

Copy file name to clipboardExpand all lines: src/backend/nodes/gen_node_support.pl
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@ sub elem
777777
print $eff "\tCOMPARE_BITMAPSET_FIELD($f);\n"
778778
unless $equal_ignore;
779779
}
780-
elsif ($t eq 'int' && $f =~ 'location$')
780+
elsif ($t eq 'ParseLoc')
781781
{
782782
print $cff "\tCOPY_LOCATION_FIELD($f);\n" unless $copy_ignore;
783783
print $eff "\tCOMPARE_LOCATION_FIELD($f);\n" unless $equal_ignore;
@@ -1010,7 +1010,7 @@ sub elem
10101010
print $off "\tWRITE_BOOL_FIELD($f);\n";
10111011
print $rff "\tREAD_BOOL_FIELD($f);\n" unless $no_read;
10121012
}
1013-
elsif ($t eq 'int' && $f =~ 'location$')
1013+
elsif ($t eq 'ParseLoc')
10141014
{
10151015
print $off "\tWRITE_LOCATION_FIELD($f);\n";
10161016
print $rff "\tREAD_LOCATION_FIELD($f);\n" unless $no_read;
@@ -1303,7 +1303,7 @@ sub elem
13031303
print $jff "\tJUMBLE_NODE($f);\n"
13041304
unless $query_jumble_ignore;
13051305
}
1306-
elsif ($t eq 'int' && $f =~ 'location$')
1306+
elsif ($t eq 'ParseLoc')
13071307
{
13081308
# Track the node's location only if directly requested.
13091309
if ($query_jumble_location)

‎src/include/nodes/nodes.h

Copy file name to clipboardExpand all lines: src/include/nodes/nodes.h
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,15 @@ extern void *copyObjectImpl(const void *from);
229229
extern bool equal(const void *a, const void *b);
230230

231231

232+
/*
233+
* Typedef for parse location. This is just an int, but this way
234+
* gen_node_support.pl knows which fields should get special treatment for
235+
* location values.
236+
*
237+
* -1 is used for unknown.
238+
*/
239+
typedef int ParseLoc;
240+
232241
/*
233242
* Typedefs for identifying qualifier selectivities, plan costs, and row
234243
* counts as such. These are just plain "double"s, but declaring a variable

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.