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" print $eff "\tCOMPARE_BITMAPSET_FIELD($f);\n"
unless $equal_ignore; unless $equal_ignore;
} }
elsif ($t eq 'int' && $f =~ 'location$') elsif ($t eq 'ParseLoc')
{ {
print $cff "\tCOPY_LOCATION_FIELD($f);\n" unless $copy_ignore; print $cff "\tCOPY_LOCATION_FIELD($f);\n" unless $copy_ignore;
print $eff "\tCOMPARE_LOCATION_FIELD($f);\n" unless $equal_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 $off "\tWRITE_BOOL_FIELD($f);\n";
print $rff "\tREAD_BOOL_FIELD($f);\n" unless $no_read; 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 $off "\tWRITE_LOCATION_FIELD($f);\n";
print $rff "\tREAD_LOCATION_FIELD($f);\n" unless $no_read; 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" print $jff "\tJUMBLE_NODE($f);\n"
unless $query_jumble_ignore; unless $query_jumble_ignore;
} }
elsif ($t eq 'int' && $f =~ 'location$') elsif ($t eq 'ParseLoc')
{ {
# Track the node's location only if directly requested. # Track the node's location only if directly requested.
if ($query_jumble_location) if ($query_jumble_location)

View file

@ -229,6 +229,15 @@ extern void *copyObjectImpl(const void *from);
extern bool equal(const void *a, const void *b); extern bool equal(const void *a, const void *b);
/*
* Typedef for parse location. This is just an int, but this way
* gen_node_support.pl knows which fields should get special treatment for
* location values.
*
* -1 is used for unknown.
*/
typedef int ParseLoc;
/* /*
* Typedefs for identifying qualifier selectivities, plan costs, and row * Typedefs for identifying qualifier selectivities, plan costs, and row
* counts as such. These are just plain "double"s, but declaring a variable * counts as such. These are just plain "double"s, but declaring a variable

View file

@ -234,9 +234,9 @@ typedef struct Query
* both be -1 meaning "unknown". * both be -1 meaning "unknown".
*/ */
/* start location, or -1 if unknown */ /* start location, or -1 if unknown */
int stmt_location; ParseLoc stmt_location;
/* length in bytes; 0 means "rest of string" */ /* length in bytes; 0 means "rest of string" */
int stmt_len pg_node_attr(query_jumble_ignore); ParseLoc stmt_len pg_node_attr(query_jumble_ignore);
} Query; } Query;
@ -271,7 +271,7 @@ typedef struct TypeName
List *typmods; /* type modifier expression(s) */ List *typmods; /* type modifier expression(s) */
int32 typemod; /* prespecified type modifier */ int32 typemod; /* prespecified type modifier */
List *arrayBounds; /* array bounds */ List *arrayBounds; /* array bounds */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} TypeName; } TypeName;
/* /*
@ -291,7 +291,7 @@ typedef struct ColumnRef
{ {
NodeTag type; NodeTag type;
List *fields; /* field names (String nodes) or A_Star */ List *fields; /* field names (String nodes) or A_Star */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} ColumnRef; } ColumnRef;
/* /*
@ -301,7 +301,7 @@ typedef struct ParamRef
{ {
NodeTag type; NodeTag type;
int number; /* the number of the parameter */ int number; /* the number of the parameter */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} ParamRef; } ParamRef;
/* /*
@ -334,7 +334,7 @@ typedef struct A_Expr
List *name; /* possibly-qualified name of operator */ List *name; /* possibly-qualified name of operator */
Node *lexpr; /* left argument, or NULL if none */ Node *lexpr; /* left argument, or NULL if none */
Node *rexpr; /* right argument, or NULL if none */ Node *rexpr; /* right argument, or NULL if none */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} A_Expr; } A_Expr;
/* /*
@ -360,7 +360,7 @@ typedef struct A_Const
NodeTag type; NodeTag type;
union ValUnion val; union ValUnion val;
bool isnull; /* SQL NULL constant */ bool isnull; /* SQL NULL constant */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} A_Const; } A_Const;
/* /*
@ -371,7 +371,7 @@ typedef struct TypeCast
NodeTag type; NodeTag type;
Node *arg; /* the expression being casted */ Node *arg; /* the expression being casted */
TypeName *typeName; /* the target type */ TypeName *typeName; /* the target type */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} TypeCast; } TypeCast;
/* /*
@ -382,7 +382,7 @@ typedef struct CollateClause
NodeTag type; NodeTag type;
Node *arg; /* input expression */ Node *arg; /* input expression */
List *collname; /* possibly-qualified collation name */ List *collname; /* possibly-qualified collation name */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} CollateClause; } CollateClause;
/* /*
@ -402,7 +402,7 @@ typedef struct RoleSpec
NodeTag type; NodeTag type;
RoleSpecType roletype; /* Type of this rolespec */ RoleSpecType roletype; /* Type of this rolespec */
char *rolename; /* filled only for ROLESPEC_CSTRING */ char *rolename; /* filled only for ROLESPEC_CSTRING */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} RoleSpec; } RoleSpec;
/* /*
@ -432,7 +432,7 @@ typedef struct FuncCall
bool agg_distinct; /* arguments were labeled DISTINCT */ bool agg_distinct; /* arguments were labeled DISTINCT */
bool func_variadic; /* last argument was labeled VARIADIC */ bool func_variadic; /* last argument was labeled VARIADIC */
CoercionForm funcformat; /* how to display this node */ CoercionForm funcformat; /* how to display this node */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} FuncCall; } FuncCall;
/* /*
@ -489,7 +489,7 @@ typedef struct A_ArrayExpr
{ {
NodeTag type; NodeTag type;
List *elements; /* array element expressions */ List *elements; /* array element expressions */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} A_ArrayExpr; } A_ArrayExpr;
/* /*
@ -516,7 +516,7 @@ typedef struct ResTarget
char *name; /* column name or NULL */ char *name; /* column name or NULL */
List *indirection; /* subscripts, field names, and '*', or NIL */ List *indirection; /* subscripts, field names, and '*', or NIL */
Node *val; /* the value expression to compute or assign */ Node *val; /* the value expression to compute or assign */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} ResTarget; } ResTarget;
/* /*
@ -546,7 +546,7 @@ typedef struct SortBy
SortByDir sortby_dir; /* ASC/DESC/USING/default */ SortByDir sortby_dir; /* ASC/DESC/USING/default */
SortByNulls sortby_nulls; /* NULLS FIRST/LAST */ SortByNulls sortby_nulls; /* NULLS FIRST/LAST */
List *useOp; /* name of op to use, if SORTBY_USING */ List *useOp; /* name of op to use, if SORTBY_USING */
int location; /* operator location, or -1 if none/unknown */ ParseLoc location; /* operator location, or -1 if none/unknown */
} SortBy; } SortBy;
/* /*
@ -567,7 +567,7 @@ typedef struct WindowDef
int frameOptions; /* frame_clause options, see below */ int frameOptions; /* frame_clause options, see below */
Node *startOffset; /* expression for starting bound, if any */ Node *startOffset; /* expression for starting bound, if any */
Node *endOffset; /* expression for ending bound, if any */ Node *endOffset; /* expression for ending bound, if any */
int location; /* parse location, or -1 if none/unknown */ ParseLoc location; /* parse location, or -1 if none/unknown */
} WindowDef; } WindowDef;
/* /*
@ -657,7 +657,7 @@ typedef struct RangeTableFunc
List *namespaces; /* list of namespaces as ResTarget */ List *namespaces; /* list of namespaces as ResTarget */
List *columns; /* list of RangeTableFuncCol */ List *columns; /* list of RangeTableFuncCol */
Alias *alias; /* table alias & optional column aliases */ Alias *alias; /* table alias & optional column aliases */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} RangeTableFunc; } RangeTableFunc;
/* /*
@ -675,7 +675,7 @@ typedef struct RangeTableFuncCol
bool is_not_null; /* does it have NOT NULL? */ bool is_not_null; /* does it have NOT NULL? */
Node *colexpr; /* column filter expression */ Node *colexpr; /* column filter expression */
Node *coldefexpr; /* column default value expression */ Node *coldefexpr; /* column default value expression */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} RangeTableFuncCol; } RangeTableFuncCol;
/* /*
@ -695,7 +695,7 @@ typedef struct RangeTableSample
List *method; /* sampling method name (possibly qualified) */ List *method; /* sampling method name (possibly qualified) */
List *args; /* argument(s) for sampling method */ List *args; /* argument(s) for sampling method */
Node *repeatable; /* REPEATABLE expression, or NULL if none */ Node *repeatable; /* REPEATABLE expression, or NULL if none */
int location; /* method name location, or -1 if unknown */ ParseLoc location; /* method name location, or -1 if unknown */
} RangeTableSample; } RangeTableSample;
/* /*
@ -738,7 +738,7 @@ typedef struct ColumnDef
Oid collOid; /* collation OID (InvalidOid if not set) */ Oid collOid; /* collation OID (InvalidOid if not set) */
List *constraints; /* other constraints on column */ List *constraints; /* other constraints on column */
List *fdwoptions; /* per-column FDW options */ List *fdwoptions; /* per-column FDW options */
int location; /* parse location, or -1 if none/unknown */ ParseLoc location; /* parse location, or -1 if none/unknown */
} ColumnDef; } ColumnDef;
/* /*
@ -812,7 +812,7 @@ typedef struct DefElem
Node *arg; /* typically Integer, Float, String, or Node *arg; /* typically Integer, Float, String, or
* TypeName */ * TypeName */
DefElemAction defaction; /* unspecified action, or SET/ADD/DROP */ DefElemAction defaction; /* unspecified action, or SET/ADD/DROP */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} DefElem; } DefElem;
/* /*
@ -842,7 +842,7 @@ typedef struct XmlSerialize
Node *expr; Node *expr;
TypeName *typeName; TypeName *typeName;
bool indent; /* [NO] INDENT */ bool indent; /* [NO] INDENT */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} XmlSerialize; } XmlSerialize;
/* Partitioning related definitions */ /* Partitioning related definitions */
@ -860,7 +860,7 @@ typedef struct PartitionElem
Node *expr; /* expression to partition on, or NULL */ Node *expr; /* expression to partition on, or NULL */
List *collation; /* name of collation; NIL = default */ List *collation; /* name of collation; NIL = default */
List *opclass; /* name of desired opclass; NIL = default */ List *opclass; /* name of desired opclass; NIL = default */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} PartitionElem; } PartitionElem;
typedef enum PartitionStrategy typedef enum PartitionStrategy
@ -880,7 +880,7 @@ typedef struct PartitionSpec
NodeTag type; NodeTag type;
PartitionStrategy strategy; PartitionStrategy strategy;
List *partParams; /* List of PartitionElems */ List *partParams; /* List of PartitionElems */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} PartitionSpec; } PartitionSpec;
/* /*
@ -907,7 +907,7 @@ struct PartitionBoundSpec
List *lowerdatums; /* List of PartitionRangeDatums */ List *lowerdatums; /* List of PartitionRangeDatums */
List *upperdatums; /* List of PartitionRangeDatums */ List *upperdatums; /* List of PartitionRangeDatums */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
}; };
/* /*
@ -930,7 +930,7 @@ typedef struct PartitionRangeDatum
Node *value; /* Const (or A_Const in raw tree), if kind is Node *value; /* Const (or A_Const in raw tree), if kind is
* PARTITION_RANGE_DATUM_VALUE, else NULL */ * PARTITION_RANGE_DATUM_VALUE, else NULL */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} PartitionRangeDatum; } PartitionRangeDatum;
/* /*
@ -1466,7 +1466,7 @@ typedef struct GroupingSet
NodeTag type; NodeTag type;
GroupingSetKind kind pg_node_attr(query_jumble_ignore); GroupingSetKind kind pg_node_attr(query_jumble_ignore);
List *content; List *content;
int location; ParseLoc location;
} GroupingSet; } GroupingSet;
/* /*
@ -1554,7 +1554,7 @@ typedef struct WithClause
NodeTag type; NodeTag type;
List *ctes; /* list of CommonTableExprs */ List *ctes; /* list of CommonTableExprs */
bool recursive; /* true = WITH RECURSIVE */ bool recursive; /* true = WITH RECURSIVE */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} WithClause; } WithClause;
/* /*
@ -1569,7 +1569,7 @@ typedef struct InferClause
List *indexElems; /* IndexElems to infer unique index */ List *indexElems; /* IndexElems to infer unique index */
Node *whereClause; /* qualification (partial-index predicate) */ Node *whereClause; /* qualification (partial-index predicate) */
char *conname; /* Constraint name, or NULL if unnamed */ char *conname; /* Constraint name, or NULL if unnamed */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} InferClause; } InferClause;
/* /*
@ -1585,7 +1585,7 @@ typedef struct OnConflictClause
InferClause *infer; /* Optional index inference clause */ InferClause *infer; /* Optional index inference clause */
List *targetList; /* the target list (of ResTarget) */ List *targetList; /* the target list (of ResTarget) */
Node *whereClause; /* qualifications */ Node *whereClause; /* qualifications */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} OnConflictClause; } OnConflictClause;
/* /*
@ -1606,7 +1606,7 @@ typedef struct CTESearchClause
List *search_col_list; List *search_col_list;
bool search_breadth_first; bool search_breadth_first;
char *search_seq_column; char *search_seq_column;
int location; ParseLoc location;
} CTESearchClause; } CTESearchClause;
typedef struct CTECycleClause typedef struct CTECycleClause
@ -1617,7 +1617,7 @@ typedef struct CTECycleClause
Node *cycle_mark_value; Node *cycle_mark_value;
Node *cycle_mark_default; Node *cycle_mark_default;
char *cycle_path_column; char *cycle_path_column;
int location; ParseLoc location;
/* These fields are set during parse analysis: */ /* These fields are set during parse analysis: */
Oid cycle_mark_type; /* common type of _value and _default */ Oid cycle_mark_type; /* common type of _value and _default */
int cycle_mark_typmod; int cycle_mark_typmod;
@ -1641,7 +1641,7 @@ typedef struct CommonTableExpr
Node *ctequery; /* the CTE's subquery */ Node *ctequery; /* the CTE's subquery */
CTESearchClause *search_clause pg_node_attr(query_jumble_ignore); CTESearchClause *search_clause pg_node_attr(query_jumble_ignore);
CTECycleClause *cycle_clause pg_node_attr(query_jumble_ignore); CTECycleClause *cycle_clause pg_node_attr(query_jumble_ignore);
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
/* These fields are set during parse analysis: */ /* These fields are set during parse analysis: */
/* is this CTE actually recursive? */ /* is this CTE actually recursive? */
bool cterecursive pg_node_attr(query_jumble_ignore); bool cterecursive pg_node_attr(query_jumble_ignore);
@ -1737,7 +1737,7 @@ typedef struct JsonParseExpr
JsonValueExpr *expr; /* string expression */ JsonValueExpr *expr; /* string expression */
JsonOutput *output; /* RETURNING clause, if specified */ JsonOutput *output; /* RETURNING clause, if specified */
bool unique_keys; /* WITH UNIQUE KEYS? */ bool unique_keys; /* WITH UNIQUE KEYS? */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} JsonParseExpr; } JsonParseExpr;
/* /*
@ -1749,7 +1749,7 @@ typedef struct JsonScalarExpr
NodeTag type; NodeTag type;
Expr *expr; /* scalar expression */ Expr *expr; /* scalar expression */
JsonOutput *output; /* RETURNING clause, if specified */ JsonOutput *output; /* RETURNING clause, if specified */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} JsonScalarExpr; } JsonScalarExpr;
/* /*
@ -1761,7 +1761,7 @@ typedef struct JsonSerializeExpr
NodeTag type; NodeTag type;
JsonValueExpr *expr; /* json value expression */ JsonValueExpr *expr; /* json value expression */
JsonOutput *output; /* RETURNING clause, if specified */ JsonOutput *output; /* RETURNING clause, if specified */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} JsonSerializeExpr; } JsonSerializeExpr;
/* /*
@ -1775,7 +1775,7 @@ typedef struct JsonObjectConstructor
JsonOutput *output; /* RETURNING clause, if specified */ JsonOutput *output; /* RETURNING clause, if specified */
bool absent_on_null; /* skip NULL values? */ bool absent_on_null; /* skip NULL values? */
bool unique; /* check key uniqueness? */ bool unique; /* check key uniqueness? */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} JsonObjectConstructor; } JsonObjectConstructor;
/* /*
@ -1788,7 +1788,7 @@ typedef struct JsonArrayConstructor
List *exprs; /* list of JsonValueExpr elements */ List *exprs; /* list of JsonValueExpr elements */
JsonOutput *output; /* RETURNING clause, if specified */ JsonOutput *output; /* RETURNING clause, if specified */
bool absent_on_null; /* skip NULL elements? */ bool absent_on_null; /* skip NULL elements? */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} JsonArrayConstructor; } JsonArrayConstructor;
/* /*
@ -1802,7 +1802,7 @@ typedef struct JsonArrayQueryConstructor
JsonOutput *output; /* RETURNING clause, if specified */ JsonOutput *output; /* RETURNING clause, if specified */
JsonFormat *format; /* FORMAT clause for subquery, if specified */ JsonFormat *format; /* FORMAT clause for subquery, if specified */
bool absent_on_null; /* skip NULL elements? */ bool absent_on_null; /* skip NULL elements? */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} JsonArrayQueryConstructor; } JsonArrayQueryConstructor;
/* /*
@ -1817,7 +1817,7 @@ typedef struct JsonAggConstructor
Node *agg_filter; /* FILTER clause, if any */ Node *agg_filter; /* FILTER clause, if any */
List *agg_order; /* ORDER BY clause, if any */ List *agg_order; /* ORDER BY clause, if any */
struct WindowDef *over; /* OVER clause, if any */ struct WindowDef *over; /* OVER clause, if any */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} JsonAggConstructor; } JsonAggConstructor;
/* /*
@ -1871,8 +1871,8 @@ typedef struct RawStmt
NodeTag type; NodeTag type;
Node *stmt; /* raw parse tree */ Node *stmt; /* raw parse tree */
int stmt_location; /* start location, or -1 if unknown */ ParseLoc stmt_location; /* start location, or -1 if unknown */
int stmt_len; /* length in bytes; 0 means "rest of string" */ ParseLoc stmt_len; /* length in bytes; 0 means "rest of string" */
} RawStmt; } RawStmt;
/***************************************************************************** /*****************************************************************************
@ -2080,7 +2080,7 @@ typedef struct PLAssignStmt
List *indirection; /* subscripts and field names, if any */ List *indirection; /* subscripts and field names, if any */
int nnames; /* number of names to use in ColumnRef */ int nnames; /* number of names to use in ColumnRef */
SelectStmt *val; /* the PL/pgSQL expression to assign */ SelectStmt *val; /* the PL/pgSQL expression to assign */
int location; /* name's token location, or -1 if unknown */ ParseLoc location; /* name's token location, or -1 if unknown */
} PLAssignStmt; } PLAssignStmt;
@ -2622,7 +2622,7 @@ typedef struct Constraint
Oid old_pktable_oid; /* pg_constraint.confrelid of my former Oid old_pktable_oid; /* pg_constraint.confrelid of my former
* self */ * self */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} Constraint; } Constraint;
/* ---------------------- /* ----------------------
@ -3529,7 +3529,7 @@ typedef struct TransactionStmt
char *gid pg_node_attr(query_jumble_ignore); char *gid pg_node_attr(query_jumble_ignore);
bool chain; /* AND CHAIN option */ bool chain; /* AND CHAIN option */
/* token location, or -1 if unknown */ /* token location, or -1 if unknown */
int location pg_node_attr(query_jumble_location); ParseLoc location pg_node_attr(query_jumble_location);
} TransactionStmt; } TransactionStmt;
/* ---------------------- /* ----------------------
@ -3915,7 +3915,7 @@ typedef struct DeallocateStmt
/* true if DEALLOCATE ALL */ /* true if DEALLOCATE ALL */
bool isall; bool isall;
/* token location, or -1 if unknown */ /* token location, or -1 if unknown */
int location pg_node_attr(query_jumble_location); ParseLoc location pg_node_attr(query_jumble_location);
} DeallocateStmt; } DeallocateStmt;
/* /*
@ -4003,7 +4003,7 @@ typedef struct PublicationObjSpec
PublicationObjSpecType pubobjtype; /* type of this publication object */ PublicationObjSpecType pubobjtype; /* type of this publication object */
char *name; char *name;
PublicationTable *pubtable; PublicationTable *pubtable;
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} PublicationObjSpec; } PublicationObjSpec;
typedef struct CreatePublicationStmt typedef struct CreatePublicationStmt

View file

@ -95,8 +95,8 @@ typedef struct PlannedStmt
Node *utilityStmt; /* non-null if this is utility stmt */ Node *utilityStmt; /* non-null if this is utility stmt */
/* statement location in source string (copied from Query) */ /* statement location in source string (copied from Query) */
int stmt_location; /* start location, or -1 if unknown */ ParseLoc stmt_location; /* start location, or -1 if unknown */
int stmt_len; /* length in bytes; 0 means "rest of string" */ ParseLoc stmt_len; /* length in bytes; 0 means "rest of string" */
} PlannedStmt; } PlannedStmt;
/* macro for fetching the Plan associated with a SubPlan node */ /* macro for fetching the Plan associated with a SubPlan node */

View file

@ -91,7 +91,7 @@ typedef struct RangeVar
Alias *alias; Alias *alias;
/* token location, or -1 if unknown */ /* token location, or -1 if unknown */
int location; ParseLoc location;
} RangeVar; } RangeVar;
/* /*
@ -128,7 +128,7 @@ typedef struct TableFunc
/* counts from 0; -1 if none specified */ /* counts from 0; -1 if none specified */
int ordinalitycol pg_node_attr(query_jumble_ignore); int ordinalitycol pg_node_attr(query_jumble_ignore);
/* token location, or -1 if unknown */ /* token location, or -1 if unknown */
int location; ParseLoc location;
} TableFunc; } TableFunc;
/* /*
@ -276,7 +276,7 @@ typedef struct Var
AttrNumber varattnosyn pg_node_attr(equal_ignore, query_jumble_ignore); AttrNumber varattnosyn pg_node_attr(equal_ignore, query_jumble_ignore);
/* token location, or -1 if unknown */ /* token location, or -1 if unknown */
int location; ParseLoc location;
} Var; } Var;
/* /*
@ -318,7 +318,7 @@ typedef struct Const
* token location, or -1 if unknown. All constants are tracked as * token location, or -1 if unknown. All constants are tracked as
* locations in query jumbling, to be marked as parameters. * locations in query jumbling, to be marked as parameters.
*/ */
int location pg_node_attr(query_jumble_location); ParseLoc location pg_node_attr(query_jumble_location);
} Const; } Const;
/* /*
@ -367,7 +367,7 @@ typedef struct Param
/* OID of collation, or InvalidOid if none */ /* OID of collation, or InvalidOid if none */
Oid paramcollid pg_node_attr(query_jumble_ignore); Oid paramcollid pg_node_attr(query_jumble_ignore);
/* token location, or -1 if unknown */ /* token location, or -1 if unknown */
int location; ParseLoc location;
} Param; } Param;
/* /*
@ -490,7 +490,7 @@ typedef struct Aggref
int aggtransno pg_node_attr(query_jumble_ignore); int aggtransno pg_node_attr(query_jumble_ignore);
/* token location, or -1 if unknown */ /* token location, or -1 if unknown */
int location; ParseLoc location;
} Aggref; } Aggref;
/* /*
@ -537,7 +537,7 @@ typedef struct GroupingFunc
Index agglevelsup; Index agglevelsup;
/* token location */ /* token location */
int location; ParseLoc location;
} GroupingFunc; } GroupingFunc;
/* /*
@ -568,7 +568,7 @@ typedef struct WindowFunc
/* is function a simple aggregate? */ /* is function a simple aggregate? */
bool winagg pg_node_attr(query_jumble_ignore); bool winagg pg_node_attr(query_jumble_ignore);
/* token location, or -1 if unknown */ /* token location, or -1 if unknown */
int location; ParseLoc location;
} WindowFunc; } WindowFunc;
/* /*
@ -589,7 +589,7 @@ typedef struct MergeSupportFunc
/* OID of collation, or InvalidOid if none */ /* OID of collation, or InvalidOid if none */
Oid msfcollid; Oid msfcollid;
/* token location, or -1 if unknown */ /* token location, or -1 if unknown */
int location; ParseLoc location;
} MergeSupportFunc; } MergeSupportFunc;
/* /*
@ -723,7 +723,7 @@ typedef struct FuncExpr
/* arguments to the function */ /* arguments to the function */
List *args; List *args;
/* token location, or -1 if unknown */ /* token location, or -1 if unknown */
int location; ParseLoc location;
} FuncExpr; } FuncExpr;
/* /*
@ -750,7 +750,7 @@ typedef struct NamedArgExpr
/* argument's number in positional notation */ /* argument's number in positional notation */
int argnumber; int argnumber;
/* argument name location, or -1 if unknown */ /* argument name location, or -1 if unknown */
int location; ParseLoc location;
} NamedArgExpr; } NamedArgExpr;
/* /*
@ -792,7 +792,7 @@ typedef struct OpExpr
List *args; List *args;
/* token location, or -1 if unknown */ /* token location, or -1 if unknown */
int location; ParseLoc location;
} OpExpr; } OpExpr;
/* /*
@ -872,7 +872,7 @@ typedef struct ScalarArrayOpExpr
List *args; List *args;
/* token location, or -1 if unknown */ /* token location, or -1 if unknown */
int location; ParseLoc location;
} ScalarArrayOpExpr; } ScalarArrayOpExpr;
/* /*
@ -894,7 +894,7 @@ typedef struct BoolExpr
Expr xpr; Expr xpr;
BoolExprType boolop; BoolExprType boolop;
List *args; /* arguments to this expression */ List *args; /* arguments to this expression */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} BoolExpr; } BoolExpr;
/* /*
@ -971,7 +971,7 @@ typedef struct SubLink
List *operName pg_node_attr(query_jumble_ignore); List *operName pg_node_attr(query_jumble_ignore);
/* subselect as Query* or raw parsetree */ /* subselect as Query* or raw parsetree */
Node *subselect; Node *subselect;
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} SubLink; } SubLink;
/* /*
@ -1145,7 +1145,7 @@ typedef struct RelabelType
Oid resultcollid pg_node_attr(query_jumble_ignore); Oid resultcollid pg_node_attr(query_jumble_ignore);
/* how to display this node */ /* how to display this node */
CoercionForm relabelformat pg_node_attr(query_jumble_ignore); CoercionForm relabelformat pg_node_attr(query_jumble_ignore);
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} RelabelType; } RelabelType;
/* ---------------- /* ----------------
@ -1167,7 +1167,7 @@ typedef struct CoerceViaIO
Oid resultcollid pg_node_attr(query_jumble_ignore); Oid resultcollid pg_node_attr(query_jumble_ignore);
/* how to display this node */ /* how to display this node */
CoercionForm coerceformat pg_node_attr(query_jumble_ignore); CoercionForm coerceformat pg_node_attr(query_jumble_ignore);
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} CoerceViaIO; } CoerceViaIO;
/* ---------------- /* ----------------
@ -1195,7 +1195,7 @@ typedef struct ArrayCoerceExpr
Oid resultcollid pg_node_attr(query_jumble_ignore); Oid resultcollid pg_node_attr(query_jumble_ignore);
/* how to display this node */ /* how to display this node */
CoercionForm coerceformat pg_node_attr(query_jumble_ignore); CoercionForm coerceformat pg_node_attr(query_jumble_ignore);
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} ArrayCoerceExpr; } ArrayCoerceExpr;
/* ---------------- /* ----------------
@ -1219,7 +1219,7 @@ typedef struct ConvertRowtypeExpr
/* Like RowExpr, we deliberately omit a typmod and collation here */ /* Like RowExpr, we deliberately omit a typmod and collation here */
/* how to display this node */ /* how to display this node */
CoercionForm convertformat pg_node_attr(query_jumble_ignore); CoercionForm convertformat pg_node_attr(query_jumble_ignore);
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} ConvertRowtypeExpr; } ConvertRowtypeExpr;
/*---------- /*----------
@ -1234,7 +1234,7 @@ typedef struct CollateExpr
Expr xpr; Expr xpr;
Expr *arg; /* input expression */ Expr *arg; /* input expression */
Oid collOid; /* collation's OID */ Oid collOid; /* collation's OID */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} CollateExpr; } CollateExpr;
/*---------- /*----------
@ -1269,7 +1269,7 @@ typedef struct CaseExpr
Expr *arg; /* implicit equality comparison argument */ Expr *arg; /* implicit equality comparison argument */
List *args; /* the arguments (list of WHEN clauses) */ List *args; /* the arguments (list of WHEN clauses) */
Expr *defresult; /* the default result (ELSE clause) */ Expr *defresult; /* the default result (ELSE clause) */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} CaseExpr; } CaseExpr;
/* /*
@ -1280,7 +1280,7 @@ typedef struct CaseWhen
Expr xpr; Expr xpr;
Expr *expr; /* condition expression */ Expr *expr; /* condition expression */
Expr *result; /* substitution result */ Expr *result; /* substitution result */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} CaseWhen; } CaseWhen;
/* /*
@ -1337,7 +1337,7 @@ typedef struct ArrayExpr
/* true if elements are sub-arrays */ /* true if elements are sub-arrays */
bool multidims pg_node_attr(query_jumble_ignore); bool multidims pg_node_attr(query_jumble_ignore);
/* token location, or -1 if unknown */ /* token location, or -1 if unknown */
int location; ParseLoc location;
} ArrayExpr; } ArrayExpr;
/* /*
@ -1388,7 +1388,7 @@ typedef struct RowExpr
/* list of String, or NIL */ /* list of String, or NIL */
List *colnames pg_node_attr(query_jumble_ignore); List *colnames pg_node_attr(query_jumble_ignore);
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} RowExpr; } RowExpr;
/* /*
@ -1447,7 +1447,7 @@ typedef struct CoalesceExpr
/* the arguments */ /* the arguments */
List *args; List *args;
/* token location, or -1 if unknown */ /* token location, or -1 if unknown */
int location; ParseLoc location;
} CoalesceExpr; } CoalesceExpr;
/* /*
@ -1473,7 +1473,7 @@ typedef struct MinMaxExpr
/* the arguments */ /* the arguments */
List *args; List *args;
/* token location, or -1 if unknown */ /* token location, or -1 if unknown */
int location; ParseLoc location;
} MinMaxExpr; } MinMaxExpr;
/* /*
@ -1517,7 +1517,7 @@ typedef struct SQLValueFunction
*/ */
Oid type pg_node_attr(query_jumble_ignore); Oid type pg_node_attr(query_jumble_ignore);
int32 typmod; int32 typmod;
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} SQLValueFunction; } SQLValueFunction;
/* /*
@ -1570,7 +1570,7 @@ typedef struct XmlExpr
Oid type pg_node_attr(query_jumble_ignore); Oid type pg_node_attr(query_jumble_ignore);
int32 typmod pg_node_attr(query_jumble_ignore); int32 typmod pg_node_attr(query_jumble_ignore);
/* token location, or -1 if unknown */ /* token location, or -1 if unknown */
int location; ParseLoc location;
} XmlExpr; } XmlExpr;
/* /*
@ -1606,7 +1606,7 @@ typedef struct JsonFormat
NodeTag type; NodeTag type;
JsonFormatType format_type; /* format type */ JsonFormatType format_type; /* format type */
JsonEncoding encoding; /* JSON encoding */ JsonEncoding encoding; /* JSON encoding */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} JsonFormat; } JsonFormat;
/* /*
@ -1662,7 +1662,7 @@ typedef struct JsonConstructorExpr
JsonReturning *returning; /* RETURNING clause */ JsonReturning *returning; /* RETURNING clause */
bool absent_on_null; /* ABSENT ON NULL? */ bool absent_on_null; /* ABSENT ON NULL? */
bool unique; /* WITH UNIQUE KEYS? (JSON_OBJECT[AGG] only) */ bool unique; /* WITH UNIQUE KEYS? (JSON_OBJECT[AGG] only) */
int location; ParseLoc location;
} JsonConstructorExpr; } JsonConstructorExpr;
/* /*
@ -1688,7 +1688,7 @@ typedef struct JsonIsPredicate
JsonFormat *format; /* FORMAT clause, if specified */ JsonFormat *format; /* FORMAT clause, if specified */
JsonValueType item_type; /* JSON item type */ JsonValueType item_type; /* JSON item type */
bool unique_keys; /* check key uniqueness? */ bool unique_keys; /* check key uniqueness? */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} JsonIsPredicate; } JsonIsPredicate;
/* ---------------- /* ----------------
@ -1722,7 +1722,7 @@ typedef struct NullTest
NullTestType nulltesttype; /* IS NULL, IS NOT NULL */ NullTestType nulltesttype; /* IS NULL, IS NOT NULL */
/* T to perform field-by-field null checks */ /* T to perform field-by-field null checks */
bool argisrow pg_node_attr(query_jumble_ignore); bool argisrow pg_node_attr(query_jumble_ignore);
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} NullTest; } NullTest;
/* /*
@ -1744,7 +1744,7 @@ typedef struct BooleanTest
Expr xpr; Expr xpr;
Expr *arg; /* input expression */ Expr *arg; /* input expression */
BoolTestType booltesttype; /* test type */ BoolTestType booltesttype; /* test type */
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} BooleanTest; } BooleanTest;
@ -1786,7 +1786,7 @@ typedef struct CoerceToDomain
Oid resultcollid pg_node_attr(query_jumble_ignore); Oid resultcollid pg_node_attr(query_jumble_ignore);
/* how to display this node */ /* how to display this node */
CoercionForm coercionformat pg_node_attr(query_jumble_ignore); CoercionForm coercionformat pg_node_attr(query_jumble_ignore);
int location; /* token location, or -1 if unknown */ ParseLoc location; /* token location, or -1 if unknown */
} CoerceToDomain; } CoerceToDomain;
/* /*
@ -1808,7 +1808,7 @@ typedef struct CoerceToDomainValue
/* collation for the substituted value */ /* collation for the substituted value */
Oid collation pg_node_attr(query_jumble_ignore); Oid collation pg_node_attr(query_jumble_ignore);
/* token location, or -1 if unknown */ /* token location, or -1 if unknown */
int location; ParseLoc location;
} CoerceToDomainValue; } CoerceToDomainValue;
/* /*
@ -1828,7 +1828,7 @@ typedef struct SetToDefault
/* collation for the substituted value */ /* collation for the substituted value */
Oid collation pg_node_attr(query_jumble_ignore); Oid collation pg_node_attr(query_jumble_ignore);
/* token location, or -1 if unknown */ /* token location, or -1 if unknown */
int location; ParseLoc location;
} SetToDefault; } SetToDefault;
/* /*

View file

@ -1963,6 +1963,7 @@ ParamsErrorCbData
ParentMapEntry ParentMapEntry
ParseCallbackState ParseCallbackState
ParseExprKind ParseExprKind
ParseLoc
ParseNamespaceColumn ParseNamespaceColumn
ParseNamespaceItem ParseNamespaceItem
ParseParamRefHook ParseParamRefHook