/* * PostgreSQL Token Definitions for Lime Parser Generator * * Converted from PostgreSQL gram.y (Bison format) to Lime format. * This file defines all tokens and their precedence levels. * * In Lime, tokens are implicitly defined when used as UPPERCASE symbols * in grammar rules. This file provides explicit declarations for * documentation and to establish the token numbering order. * * IMPORTANT: Non-keyword tokens must be listed first so their numeric * codes do not depend on the set of keywords. PL/pgSQL depends on this. */ /* * Token type: all tokens carry a PgToken value that includes the * semantic value and source location. */ %token_type {PgToken} /* * Extra argument passed to the parser (replaces Bison's %parse-param). * This provides access to the scanner state and parse tree output. */ %extra_argument {PgParseState *pstate} /* * Parser name prefix (replaces Bison's %name-prefix="base_yy"). */ %name pg /* ====================================================================== * NON-KEYWORD TOKENS * * These are hard-wired into the flex lexer. They must be listed first * so that their numeric codes do not depend on the set of keywords. * ====================================================================== */ /* Identifiers and literals */ %token IDENT. %token UIDENT. /* Unicode identifier (reduced to IDENT by parser) */ %token FCONST. /* Float constant */ %token SCONST. /* String constant */ %token USCONST. /* Unicode string constant (reduced to SCONST) */ %token BCONST. /* Binary string constant */ %token XCONST. /* Hex string constant */ %token OP. /* Operator */ %token ICONST. /* Integer constant */ %token PARAM. /* Parameter placeholder ($N) */ /* Multi-character operators */ %token TYPECAST. /* :: */ %token DOT_DOT. /* .. (used by PL/pgSQL) */ %token COLON_EQUALS. /* := */ %token EQUALS_GREATER. /* => */ %token LESS_EQUALS. /* <= */ %token GREATER_EQUALS. /* >= */ %token NOT_EQUALS. /* <> or != */ %token RIGHT_ARROW. /* -> */ /* ====================================================================== * KEYWORD TOKENS * * All SQL keywords, in alphabetical order. Keywords ending in _P have * the _P suffix to avoid conflicts with C reserved words or macros. * ====================================================================== */ /* A */ %token ABORT_P. %token ABSENT. %token ABSOLUTE_P. %token ACCESS. %token ACTION. %token ADD_P. %token ADMIN. %token AFTER. %token AGGREGATE. %token ALL. %token ALSO. %token ALTER. %token ALWAYS. %token ANALYSE. %token ANALYZE. %token AND. %token ANY. %token ARRAY. %token AS. %token ASC. %token ASENSITIVE. %token ASSERTION. %token ASSIGNMENT. %token ASYMMETRIC. %token AT. %token ATOMIC. %token ATTACH. %token ATTRIBUTE. %token AUTHORIZATION. /* B */ %token BACKWARD. %token BEFORE. %token BEGIN_P. %token BETWEEN. %token BIGINT. %token BINARY. %token BIT. %token BOOLEAN_P. %token BOTH. %token BREADTH. %token BY. /* C */ %token CACHE. %token CALL. %token CALLED. %token CASCADE. %token CASCADED. %token CASE. %token CAST. %token CATALOG_P. %token CHAIN. %token CHAR_P. %token CHARACTER. %token CHARACTERISTICS. %token CHECK. %token CHECKPOINT. %token CLASS. %token CLOSE. %token CLUSTER. %token COALESCE. %token COLLATE. %token COLLATION. %token COLUMN. %token COLUMNS. %token COMMENT. %token COMMENTS. %token COMMIT. %token COMMITTED. %token COMPRESSION. %token CONCURRENTLY. %token CONDITIONAL. %token CONFIGURATION. %token CONFLICT. %token CONNECTION. %token CONSTRAINT. %token CONSTRAINTS. %token CONTENT_P. %token CONTINUE_P. %token CONVERSION_P. %token COPY. %token COST. %token CREATE. %token CROSS. %token CSV. %token CUBE. %token CURRENT_P. %token CURRENT_CATALOG. %token CURRENT_DATE. %token CURRENT_ROLE. %token CURRENT_SCHEMA. %token CURRENT_TIME. %token CURRENT_TIMESTAMP. %token CURRENT_USER. %token CURSOR. %token CYCLE. /* D */ %token DATA_P. %token DATABASE. %token DAY_P. %token DEALLOCATE. %token DEC. %token DECIMAL_P. %token DECLARE. %token DEFAULT. %token DEFAULTS. %token DEFERRABLE. %token DEFERRED. %token DEFINER. %token DELETE_P. %token DELIMITER. %token DELIMITERS. %token DEPENDS. %token DEPTH. %token DESC. %token DESTINATION. %token DETACH. %token DICTIONARY. %token DISABLE_P. %token DISCARD. %token DISTINCT. %token DO. %token DOCUMENT_P. %token DOMAIN_P. %token DOUBLE_P. %token DROP. /* E */ %token EACH. %token EDGE. %token ELSE. %token EMPTY_P. %token ENABLE_P. %token ENCODING. %token ENCRYPTED. %token END_P. %token ENFORCED. %token ENUM_P. %token ERROR_P. %token ESCAPE. %token EVENT. %token EXCEPT. %token EXCLUDE. %token EXCLUDING. %token EXCLUSIVE. %token EXECUTE. %token EXISTS. %token EXPLAIN. %token EXPRESSION. %token EXTENSION. %token EXTERNAL. %token EXTRACT. /* F */ %token FALSE_P. %token FAMILY. %token FETCH. %token FILTER. %token FINALIZE. %token FIRST_P. %token FLOAT_P. %token FOLLOWING. %token FOR. %token FORCE. %token FOREIGN. %token FORMAT. %token FORWARD. %token FREEZE. %token FROM. %token FULL. %token FUNCTION. %token FUNCTIONS. /* G */ %token GENERATED. %token GLOBAL. %token GRANT. %token GRANTED. %token GRAPH. %token GRAPH_TABLE. %token GREATEST. %token GROUP_P. %token GROUPING. %token GROUPS. /* H */ %token HANDLER. %token HAVING. %token HEADER_P. %token HOLD. %token HOUR_P. /* I */ %token IDENTITY_P. %token IF_P. %token IGNORE_P. %token ILIKE. %token IMMEDIATE. %token IMMUTABLE. %token IMPLICIT_P. %token IMPORT_P. %token IN_P. %token INCLUDE. %token INCLUDING. %token INCREMENT. %token INDENT. %token INDEX. %token INDEXES. %token INHERIT. %token INHERITS. %token INITIALLY. %token INLINE_P. %token INNER_P. %token INOUT. %token INPUT_P. %token INSENSITIVE. %token INSERT. %token INSTEAD. %token INT_P. %token INTEGER. %token INTERSECT. %token INTERVAL. %token INTO. %token INVOKER. %token IS. %token ISNULL. %token ISOLATION. /* J */ %token JOIN. %token JSON. %token JSON_ARRAY. %token JSON_ARRAYAGG. %token JSON_EXISTS. %token JSON_OBJECT. %token JSON_OBJECTAGG. %token JSON_QUERY. %token JSON_SCALAR. %token JSON_SERIALIZE. %token JSON_TABLE. %token JSON_VALUE. /* K */ %token KEEP. %token KEY. %token KEYS. /* L */ %token LABEL. %token LANGUAGE. %token LARGE_P. %token LAST_P. %token LATERAL_P. %token LEADING. %token LEAKPROOF. %token LEAST. %token LEFT. %token LEVEL. %token LIKE. %token LIMIT. %token LISTEN. %token LOAD. %token LOCAL. %token LOCALTIME. %token LOCALTIMESTAMP. %token LOCATION. %token LOCK_P. %token LOCKED. %token LOGGED. %token LSN_P. /* M */ %token MAPPING. %token MATCH. %token MATCHED. %token MATERIALIZED. %token MAXVALUE. %token MERGE. %token MERGE_ACTION. %token METHOD. %token MINUTE_P. %token MINVALUE. %token MODE. %token MONTH_P. %token MOVE. /* N */ %token NAME_P. %token NAMES. %token NATIONAL. %token NATURAL. %token NCHAR. %token NESTED. %token NEW. %token NEXT. %token NFC. %token NFD. %token NFKC. %token NFKD. %token NO. %token NODE. %token NONE. %token NORMALIZE. %token NORMALIZED. %token NOT. %token NOTHING. %token NOTIFY. %token NOTNULL. %token NOWAIT. %token NULL_P. %token NULLIF. %token NULLS_P. %token NUMERIC. /* O */ %token OBJECT_P. %token OBJECTS_P. %token OF. %token OFF. %token OFFSET. %token OIDS. %token OLD. %token OMIT. %token ON. %token ONLY. %token OPERATOR. %token OPTION. %token OPTIONS. %token OR. %token ORDER. %token ORDINALITY. %token OTHERS. %token OUT_P. %token OUTER_P. %token OVER. %token OVERLAPS. %token OVERLAY. %token OVERRIDING. %token OWNED. %token OWNER. /* P */ %token PARALLEL. %token PARAMETER. %token PARSER. %token PARTIAL. %token PARTITION. %token PARTITIONS. %token PASSING. %token PASSWORD. %token PATH. %token PERIOD. %token PLACING. %token PLAN. %token PLANS. %token POLICY. %token POSITION. %token PRECEDING. %token PRECISION. %token PREPARE. %token PREPARED. %token PRESERVE. %token PRIMARY. %token PRIOR. %token PRIVILEGES. %token PROCEDURAL. %token PROCEDURE. %token PROCEDURES. %token PROGRAM. %token PROPERTIES. %token PROPERTY. %token PUBLICATION. /* Q */ %token QUOTE. %token QUOTES. /* R */ %token RANGE. %token READ. %token REAL. %token REASSIGN. %token RECURSIVE. %token REF_P. %token REFERENCES. %token REFERENCING. %token REFRESH. %token REINDEX. %token RELATIONSHIP. %token RELATIVE_P. %token RELEASE. %token RENAME. %token REPACK. %token REPEATABLE. %token REPLACE. %token REPLICA. %token RESET. %token RESPECT_P. %token RESTART. %token RESTRICT. %token RETURN. %token RETURNING. %token RETURNS. %token REVOKE. %token RIGHT. %token ROLE. %token ROLLBACK. %token ROLLUP. %token ROUTINE. %token ROUTINES. %token ROW. %token ROWS. %token RULE. /* S */ %token SAVEPOINT. %token SCALAR. %token SCHEMA. %token SCHEMAS. %token SCROLL. %token SEARCH. %token SECOND_P. %token SECURITY. %token SELECT. %token SEQUENCE. %token SEQUENCES. %token SERIALIZABLE. %token SERVER. %token SESSION. %token SESSION_USER. %token SET. %token SETOF. %token SETS. %token SHARE. %token SHOW. %token SIMILAR. %token SIMPLE. %token SKIP. %token SMALLINT. %token SNAPSHOT. %token SOME. %token SOURCE. %token SPLIT. %token SQL_P. %token STABLE. %token STANDALONE_P. %token START. %token STATEMENT. %token STATISTICS. %token STDIN. %token STDOUT. %token STORAGE. %token STORED. %token STRICT_P. %token STRING_P. %token STRIP_P. %token SUBSCRIPTION. %token SUBSTRING. %token SUPPORT. %token SYMMETRIC. %token SYSID. %token SYSTEM_P. %token SYSTEM_USER. /* T */ %token TABLE. %token TABLES. %token TABLESAMPLE. %token TABLESPACE. %token TARGET. %token TEMP. %token TEMPLATE. %token TEMPORARY. %token TEXT_P. %token THEN. %token TIES. %token TIME. %token TIMESTAMP. %token TO. %token TRAILING. %token TRANSACTION. %token TRANSFORM. %token TREAT. %token TRIGGER. %token TRIM. %token TRUE_P. %token TRUNCATE. %token TRUSTED. %token TYPE_P. %token TYPES_P. /* U */ %token UESCAPE. %token UNBOUNDED. %token UNCONDITIONAL. %token UNCOMMITTED. %token UNENCRYPTED. %token UNION. %token UNIQUE. %token UNKNOWN. %token UNLISTEN. %token UNLOGGED. %token UNTIL. %token UPDATE. %token USER. %token USING. /* V */ %token VACUUM. %token VALID. %token VALIDATE. %token VALIDATOR. %token VALUE_P. %token VALUES. %token VARCHAR. %token VARIADIC. %token VARYING. %token VERBOSE. %token VERSION_P. %token VERTEX. %token VIEW. %token VIEWS. %token VIRTUAL. %token VOLATILE. /* W */ %token WAIT. %token WHEN. %token WHERE. %token WHITESPACE_P. %token WINDOW. %token WITH. %token WITHIN. %token WITHOUT. %token WORK. %token WRAPPER. %token WRITE. /* X */ %token XML_P. %token XMLATTRIBUTES. %token XMLCONCAT. %token XMLELEMENT. %token XMLEXISTS. %token XMLFOREST. %token XMLNAMESPACES. %token XMLPARSE. %token XMLPI. %token XMLROOT. %token XMLSERIALIZE. %token XMLTABLE. /* Y */ %token YEAR_P. %token YES_P. /* Z */ %token ZONE. /* ====================================================================== * LOOKAHEAD TOKENS * * These tokens are not in kwlist.h and can never be entered directly. * The filter in the tokenizer creates these when required (based on * looking one token ahead). * * NOT_LA exists so that productions such as NOT LIKE can be given the * same precedence as LIKE; otherwise they'd effectively have the same * precedence as NOT. * * FORMAT_LA, NULLS_LA, WITH_LA, and WITHOUT_LA are needed to make the * grammar LALR(1). * ====================================================================== */ %token FORMAT_LA. %token NOT_LA. %token NULLS_LA. %token WITH_LA. %token WITHOUT_LA. /* ====================================================================== * MODE TOKENS * * These tokens are never generated by the scanner. They can be injected * by the parser wrapper as the initial token of the string to tell the * grammar to parse something other than the usual list of SQL commands. * ====================================================================== */ %token MODE_TYPE_NAME. %token MODE_PLPGSQL_EXPR. %token MODE_PLPGSQL_ASSIGN1. %token MODE_PLPGSQL_ASSIGN2. %token MODE_PLPGSQL_ASSIGN3. /* ====================================================================== * PSEUDO-TOKEN FOR PRECEDENCE * * UMINUS is not a real token. It is used only with %prec (Lime: [UMINUS]) * to give unary minus higher precedence than binary +/-. * ====================================================================== */ %token UMINUS. /* ====================================================================== * PRECEDENCE DECLARATIONS * * Listed from lowest to highest precedence. In Lime, %left, %right, and * %nonassoc have the same syntax as in Bison. Each successive declaration * defines a higher precedence level. * * In production rules, use [TOKEN] at the end of a rule to override * the default precedence (equivalent to Bison's %prec TOKEN). * ====================================================================== */ /* Set operations */ %left UNION EXCEPT. %left INTERSECT. /* Logical operators */ %left OR. %left AND. %right NOT. /* IS predicates */ %nonassoc IS ISNULL NOTNULL. /* Comparison operators */ %nonassoc LT GT EQ LESS_EQUALS GREATER_EQUALS NOT_EQUALS. /* Pattern matching and range predicates */ %nonassoc BETWEEN IN_P LIKE ILIKE SIMILAR NOT_LA. %nonassoc ESCAPE. /* UNBOUNDED and NESTED need lower precedence than IDENT-class tokens */ %nonassoc UNBOUNDED NESTED. /* Identifiers and keywords that need IDENT-level precedence */ %nonassoc IDENT PARTITION RANGE ROWS GROUPS PRECEDING FOLLOWING CUBE ROLLUP SET KEYS OBJECT_P SCALAR VALUE_P WITH WITHOUT PATH. /* User-defined and multi-character operators */ %left OP OPERATOR RIGHT_ARROW PIPE. /* Arithmetic operators */ %left PLUS MINUS. %left STAR SLASH PERCENT. %left CARET. /* Special expression operators */ %left AT. %left COLLATE. %right UMINUS. /* Subscript and grouping */ %left LBRACKET RBRACKET. %left LPAREN RPAREN. %left TYPECAST. %left DOT. /* JOIN operators (high precedence to support use as function names) */ %left JOIN CROSS LEFT FULL RIGHT INNER_P NATURAL. /* * NOTE on single-character tokens: * * Bison uses literal characters like '<', '>', '+', '-', etc. directly. * Lime does not support single-character literal tokens in the same way. * In the Lime grammar, these must be named tokens: * * Bison Lime * ----- ---- * '<' LT * '>' GT * '=' EQ * '+' PLUS * '-' MINUS * '*' STAR * '/' SLASH * '%' PERCENT * '^' CARET * '|' PIPE * '[' LBRACKET * ']' RBRACKET * '(' LPAREN * ')' RPAREN * '.' DOT * ',' COMMA * ';' SEMICOLON * ':' COLON * '#' HASH * * The tokenizer must map these characters to the named tokens above. */ %token LT. %token GT. %token EQ. %token PLUS. %token MINUS. %token STAR. %token SLASH. %token PERCENT. %token CARET. %token PIPE. %token LBRACKET. %token RBRACKET. %token LPAREN. %token RPAREN. %token DOT. %token COMMA. %token SEMICOLON. %token COLON. %token HASH. %token LBRACE. %token RBRACE. /* * PostgreSQL Grammar for Lime Parser Generator * Converted from gram.y: 782 non-terminals, 3584 alternatives. * * Conversion conventions: * Bison $$ -> A (LHS result) * Bison $N -> B,C,D,... (RHS params, 1-indexed) * Bison @N -> LOC(param) (source location) * Bison %prec TOKEN -> [TOKEN] * Bison 'x' -> named tokens (LPAREN, COMMA, etc.) * Empty alt -> nt(A) ::=. (empty RHS) */ /* NOTE: tokens.lime is prepended by the Makefile build step. * Do not add token/precedence declarations here; edit tokens.lime instead. */ %include { #include "postgres.h" #include #include #include "catalog/index.h" #include "catalog/namespace.h" #include "catalog/pg_am.h" #include "catalog/pg_trigger.h" #include "commands/defrem.h" #include "commands/trigger.h" #include "gramparse.h" #include "nodes/makefuncs.h" #include "nodes/nodeFuncs.h" #include "parser/parser.h" #include "utils/datetime.h" #include "utils/xml.h" #include "pg_gram_helpers.h" #define LOC(tok) ((tok).location) #define yyscanner (pstate->scanner) } %syntax_error { parser_yyerror("syntax error"); } %parse_failure { parser_yyerror("parse failure"); } %start_symbol parse_toplevel /* Type declarations for all non-terminals */ /* --- Bison: %type => C type: Node * --- */ %type stmt {Node *} %type toplevel_stmt {Node *} %type schema_stmt {Node *} %type routine_body_stmt {Node *} %type alterEventTrigStmt {Node *} %type alterCollationStmt {Node *} %type alterDatabaseStmt {Node *} %type alterDatabaseSetStmt {Node *} %type alterDomainStmt {Node *} %type alterEnumStmt {Node *} %type alterFdwStmt {Node *} %type alterForeignServerStmt {Node *} %type alterGroupStmt {Node *} %type alterObjectDependsStmt {Node *} %type alterObjectSchemaStmt {Node *} %type alterOwnerStmt {Node *} %type alterOperatorStmt {Node *} %type alterTypeStmt {Node *} %type alterSeqStmt {Node *} %type alterSystemStmt {Node *} %type alterTableStmt {Node *} %type alterTblSpcStmt {Node *} %type alterExtensionStmt {Node *} %type alterExtensionContentsStmt {Node *} %type alterCompositeTypeStmt {Node *} %type alterUserMappingStmt {Node *} %type alterRoleStmt {Node *} %type alterRoleSetStmt {Node *} %type alterPolicyStmt {Node *} %type alterStatsStmt {Node *} %type alterDefaultPrivilegesStmt {Node *} %type defACLAction {Node *} %type analyzeStmt {Node *} %type callStmt {Node *} %type closePortalStmt {Node *} %type commentStmt {Node *} %type constraintsSetStmt {Node *} %type copyStmt {Node *} %type createAsStmt {Node *} %type createCastStmt {Node *} %type createDomainStmt {Node *} %type createExtensionStmt {Node *} %type createGroupStmt {Node *} %type createOpClassStmt {Node *} %type createOpFamilyStmt {Node *} %type alterOpFamilyStmt {Node *} %type createPLangStmt {Node *} %type createSchemaStmt {Node *} %type createSeqStmt {Node *} %type createStmt {Node *} %type createStatsStmt {Node *} %type createTableSpaceStmt {Node *} %type createFdwStmt {Node *} %type createForeignServerStmt {Node *} %type createForeignTableStmt {Node *} %type createAssertionStmt {Node *} %type createTransformStmt {Node *} %type createTrigStmt {Node *} %type createEventTrigStmt {Node *} %type createPropGraphStmt {Node *} %type alterPropGraphStmt {Node *} %type createUserStmt {Node *} %type createUserMappingStmt {Node *} %type createRoleStmt {Node *} %type createPolicyStmt {Node *} %type createdbStmt {Node *} %type declareCursorStmt {Node *} %type defineStmt {Node *} %type deleteStmt {Node *} %type discardStmt {Node *} %type doStmt {Node *} %type dropOpClassStmt {Node *} %type dropOpFamilyStmt {Node *} %type dropStmt {Node *} %type dropCastStmt {Node *} %type dropRoleStmt {Node *} %type dropdbStmt {Node *} %type dropTableSpaceStmt {Node *} %type dropTransformStmt {Node *} %type dropUserMappingStmt {Node *} %type explainStmt {Node *} %type fetchStmt {Node *} %type grantStmt {Node *} %type grantRoleStmt {Node *} %type importForeignSchemaStmt {Node *} %type indexStmt {Node *} %type insertStmt {Node *} %type listenStmt {Node *} %type loadStmt {Node *} %type lockStmt {Node *} %type mergeStmt {Node *} %type notifyStmt {Node *} %type explainableStmt {Node *} %type preparableStmt {Node *} %type createFunctionStmt {Node *} %type alterFunctionStmt {Node *} %type reindexStmt {Node *} %type removeAggrStmt {Node *} %type removeFuncStmt {Node *} %type removeOperStmt {Node *} %type renameStmt {Node *} %type repackStmt {Node *} %type returnStmt {Node *} %type revokeStmt {Node *} %type revokeRoleStmt {Node *} %type ruleActionStmt {Node *} %type ruleActionStmtOrEmpty {Node *} %type ruleStmt {Node *} %type secLabelStmt {Node *} %type selectStmt {Node *} %type transactionStmt {Node *} %type transactionStmtLegacy {Node *} %type truncateStmt {Node *} %type unlistenStmt {Node *} %type updateStmt {Node *} %type vacuumStmt {Node *} %type variableResetStmt {Node *} %type variableSetStmt {Node *} %type variableShowStmt {Node *} %type viewStmt {Node *} %type waitStmt {Node *} %type checkPointStmt {Node *} %type createConversionStmt {Node *} %type deallocateStmt {Node *} %type prepareStmt {Node *} %type executeStmt {Node *} %type dropOwnedStmt {Node *} %type reassignOwnedStmt {Node *} %type alterTSConfigurationStmt {Node *} %type alterTSDictionaryStmt {Node *} %type createMatViewStmt {Node *} %type refreshMatViewStmt {Node *} %type createAmStmt {Node *} %type createPublicationStmt {Node *} %type alterPublicationStmt {Node *} %type createSubscriptionStmt {Node *} %type alterSubscriptionStmt {Node *} %type dropSubscriptionStmt {Node *} %type select_no_parens {Node *} %type select_with_parens {Node *} %type select_clause {Node *} %type simple_select {Node *} %type values_clause {Node *} %type pLpgSQL_Expr {Node *} %type pLAssignStmt {Node *} /* --- Bison: %type => C type: char * --- */ %type opt_single_name {char *} /* --- Bison: %type => C type: List * --- */ %type opt_qualified_name {List *} /* --- Bison: %type => C type: bool --- */ %type opt_concurrently {bool} %type opt_usingindex {bool} /* --- Bison: %type => C type: DropBehavior --- */ %type opt_drop_behavior {DropBehavior} /* --- Bison: %type => C type: List * --- */ %type opt_utility_option_list {List *} %type opt_wait_with_clause {List *} %type utility_option_list {List *} /* --- Bison: %type => C type: DefElem * --- */ %type utility_option_elem {DefElem *} /* --- Bison: %type => C type: char * --- */ %type utility_option_name {char *} /* --- Bison: %type => C type: Node * --- */ %type utility_option_arg {Node *} %type alter_column_default {Node *} %type opclass_item {Node *} %type opclass_drop {Node *} %type alter_using {Node *} /* --- Bison: %type => C type: int --- */ %type add_drop {int} %type opt_asc_desc {int} %type opt_nulls_order {int} /* --- Bison: %type => C type: Node * --- */ %type alter_table_cmd {Node *} %type alter_type_cmd {Node *} %type opt_collate_clause {Node *} %type replica_identity {Node *} %type partition_cmd {Node *} %type index_partition_cmd {Node *} /* --- Bison: %type => C type: List * --- */ %type alter_table_cmds {List *} %type alter_type_cmds {List *} %type alter_identity_column_option_list {List *} /* --- Bison: %type => C type: DefElem * --- */ %type alter_identity_column_option {DefElem *} /* --- Bison: %type => C type: Node * --- */ %type set_statistics_value {Node *} /* --- Bison: %type => C type: char * --- */ %type set_access_method_name {char *} /* --- Bison: %type => C type: List * --- */ %type createdb_opt_list {List *} %type createdb_opt_items {List *} %type copy_opt_list {List *} %type transaction_mode_list {List *} %type create_extension_opt_list {List *} %type alter_extension_opt_list {List *} /* --- Bison: %type => C type: DefElem * --- */ %type createdb_opt_item {DefElem *} %type copy_opt_item {DefElem *} %type transaction_mode_item {DefElem *} %type create_extension_opt_item {DefElem *} %type alter_extension_opt_item {DefElem *} /* --- Bison: %type => C type: int --- */ %type opt_lock {int} %type lock_type {int} %type cast_context {int} /* --- Bison: %type => C type: DefElem * --- */ %type drop_option {DefElem *} /* --- Bison: %type => C type: bool --- */ %type opt_or_replace {bool} %type opt_no {bool} %type opt_grant_grant_option {bool} %type opt_nowait {bool} %type opt_if_exists {bool} %type opt_with_data {bool} %type opt_transaction_chain {bool} /* --- Bison: %type => C type: List * --- */ %type grant_role_opt_list {List *} /* --- Bison: %type => C type: DefElem * --- */ %type grant_role_opt {DefElem *} /* --- Bison: %type => C type: Node * --- */ %type grant_role_opt_value {Node *} /* --- Bison: %type => C type: int --- */ %type opt_nowait_or_skip {int} /* --- Bison: %type => C type: List * --- */ %type optRoleList {List *} %type alterOptRoleList {List *} /* --- Bison: %type => C type: DefElem * --- */ %type createOptRoleElem {DefElem *} %type alterOptRoleElem {DefElem *} /* --- Bison: %type => C type: char * --- */ %type opt_type {char *} %type foreign_server_version {char *} %type opt_foreign_server_version {char *} %type opt_in_database {char *} %type parameter_name {char *} /* --- Bison: %type => C type: List * --- */ %type optSchemaEltList {List *} %type parameter_name_list {List *} /* --- Bison: %type => C type: char --- */ %type am_type {char} /* --- Bison: %type => C type: bool --- */ %type triggerForSpec {bool} %type triggerForType {bool} /* --- Bison: %type => C type: int --- */ %type triggerActionTime {int} /* --- Bison: %type => C type: List * --- */ %type triggerEvents {List *} %type triggerOneEvent {List *} /* --- Bison: %type => C type: Node * --- */ %type triggerFuncArg {Node *} %type triggerWhen {Node *} /* --- Bison: %type => C type: char * --- */ %type transitionRelName {char *} /* --- Bison: %type => C type: bool --- */ %type transitionRowOrTable {bool} %type transitionOldOrNew {bool} /* --- Bison: %type => C type: Node * --- */ %type triggerTransition {Node *} /* --- Bison: %type => C type: List * --- */ %type event_trigger_when_list {List *} %type event_trigger_value_list {List *} /* --- Bison: %type => C type: DefElem * --- */ %type event_trigger_when_item {DefElem *} /* --- Bison: %type => C type: char --- */ %type enable_trigger {char} /* --- Bison: %type => C type: char * --- */ %type copy_file_name {char *} %type access_method_clause {char *} %type attr_name {char *} %type table_access_method_clause {char *} %type name {char *} %type cursor_name {char *} %type file_name {char *} %type cluster_index_specification {char *} /* --- Bison: %type => C type: List * --- */ %type func_name {List *} %type handler_name {List *} %type qual_Op {List *} %type qual_all_Op {List *} %type subquery_Op {List *} %type opt_inline_handler {List *} %type opt_validator {List *} %type validator_clause {List *} %type opt_collate {List *} /* --- Bison: %type => C type: RangeVar * --- */ %type qualified_name {RangeVar *} %type insert_target {RangeVar *} %type optConstrFromTable {RangeVar *} /* --- Bison: %type => C type: char * --- */ %type all_Op {char *} %type mathOp {char *} %type row_security_cmd {char *} %type rowSecurityDefaultForCmd {char *} /* --- Bison: %type => C type: bool --- */ %type rowSecurityDefaultPermissive {bool} /* --- Bison: %type => C type: Node * --- */ %type rowSecurityOptionalWithCheck {Node *} %type rowSecurityOptionalExpr {Node *} /* --- Bison: %type => C type: List * --- */ %type rowSecurityDefaultToRole {List *} %type rowSecurityOptionalToRole {List *} /* --- Bison: %type => C type: char * --- */ %type iso_level {char *} %type opt_encoding {char *} /* --- Bison: %type => C type: roleSpec * --- */ %type grantee {roleSpec *} /* --- Bison: %type => C type: List * --- */ %type grantee_list {List *} /* --- Bison: %type => C type: AccessPriv * --- */ %type privilege {AccessPriv *} /* --- Bison: %type => C type: List * --- */ %type privileges {List *} %type privilege_list {List *} /* --- Bison: %type => C type: struct PrivTarget * --- */ %type privilege_target {struct PrivTarget *} /* --- Bison: %type => C type: ObjectWithArgs * --- */ %type function_with_argtypes {ObjectWithArgs *} %type aggregate_with_argtypes {ObjectWithArgs *} %type operator_with_argtypes {ObjectWithArgs *} /* --- Bison: %type => C type: List * --- */ %type function_with_argtypes_list {List *} %type aggregate_with_argtypes_list {List *} %type operator_with_argtypes_list {List *} /* --- Bison: %type => C type: int --- */ %type defacl_privilege_target {int} /* --- Bison: %type => C type: DefElem * --- */ %type defACLOption {DefElem *} /* --- Bison: %type => C type: List * --- */ %type defACLOptionList {List *} /* --- Bison: %type => C type: int --- */ %type import_qualification_type {int} /* --- Bison: %type => C type: struct ImportQual * --- */ %type import_qualification {struct ImportQual *} /* --- Bison: %type => C type: Node * --- */ %type vacuum_relation {Node *} /* --- Bison: %type => C type: struct SelectLimit * --- */ %type opt_select_limit {struct SelectLimit *} %type select_limit {struct SelectLimit *} %type limit_clause {struct SelectLimit *} /* --- Bison: %type => C type: List * --- */ %type parse_toplevel {List *} %type stmtmulti {List *} %type routine_body_stmt_list {List *} %type optTableElementList {List *} %type tableElementList {List *} %type optInherit {List *} %type definition {List *} %type optTypedTableElementList {List *} %type typedTableElementList {List *} %type reloptions {List *} %type opt_reloptions {List *} %type optWith {List *} %type opt_definition {List *} %type func_args {List *} %type func_args_list {List *} %type func_args_with_defaults {List *} %type func_args_with_defaults_list {List *} %type aggr_args {List *} %type aggr_args_list {List *} %type func_as {List *} %type createfunc_opt_list {List *} %type opt_createfunc_opt_list {List *} %type alterfunc_opt_list {List *} %type old_aggr_definition {List *} %type old_aggr_list {List *} %type oper_argtypes {List *} %type ruleActionList {List *} %type ruleActionMulti {List *} %type opt_column_list {List *} %type columnList {List *} %type opt_name_list {List *} %type sort_clause {List *} %type opt_sort_clause {List *} %type sortby_list {List *} %type index_params {List *} %type stats_params {List *} %type opt_include {List *} %type opt_c_include {List *} %type index_including_params {List *} %type name_list {List *} %type role_list {List *} %type from_clause {List *} %type from_list {List *} %type opt_array_bounds {List *} %type qualified_name_list {List *} %type any_name {List *} %type any_name_list {List *} %type type_name_list {List *} %type any_operator {List *} %type expr_list {List *} %type attrs {List *} %type distinct_clause {List *} %type opt_distinct_clause {List *} %type target_list {List *} %type opt_target_list {List *} %type insert_column_list {List *} %type set_target_list {List *} %type merge_values_clause {List *} %type set_clause_list {List *} %type set_clause {List *} %type def_list {List *} %type operator_def_list {List *} %type indirection {List *} %type opt_indirection {List *} %type reloption_list {List *} %type triggerFuncArgs {List *} %type opclass_item_list {List *} %type opclass_drop_list {List *} %type opclass_purpose {List *} %type opt_opfamily {List *} %type transaction_mode_list_or_empty {List *} %type optTableFuncElementList {List *} %type tableFuncElementList {List *} %type opt_type_modifiers {List *} %type prep_type_clause {List *} %type execute_param_clause {List *} %type using_clause {List *} %type returning_with_clause {List *} %type returning_options {List *} %type opt_enum_val_list {List *} %type enum_val_list {List *} %type table_func_column_list {List *} %type create_generic_options {List *} %type alter_generic_options {List *} %type relation_expr_list {List *} %type dostmt_opt_list {List *} %type transform_element_list {List *} %type transform_type_list {List *} %type triggerTransitions {List *} %type triggerReferencing {List *} %type vacuum_relation_list {List *} %type opt_vacuum_relation_list {List *} %type drop_option_list {List *} %type pub_obj_list {List *} %type pub_all_obj_type_list {List *} %type pub_except_obj_list {List *} %type opt_pub_except_clause {List *} /* --- Bison: %type => C type: ReturningClause * --- */ %type returning_clause {ReturningClause *} /* --- Bison: %type => C type: Node * --- */ %type returning_option {Node *} /* --- Bison: %type => C type: ReturningOptionKind --- */ %type returning_option_kind {ReturningOptionKind} /* --- Bison: %type => C type: Node * --- */ %type opt_routine_body {Node *} /* --- Bison: %type => C type: struct GroupClause * --- */ %type group_clause {struct GroupClause *} /* --- Bison: %type => C type: List * --- */ %type group_by_list {List *} /* --- Bison: %type => C type: Node * --- */ %type group_by_item {Node *} %type empty_grouping_set {Node *} %type rollup_clause {Node *} %type cube_clause {Node *} %type grouping_sets_clause {Node *} /* --- Bison: %type => C type: List * --- */ %type opt_fdw_options {List *} %type fdw_options {List *} /* --- Bison: %type => C type: DefElem * --- */ %type fdw_option {DefElem *} /* --- Bison: %type => C type: RangeVar * --- */ %type optTempTableName {RangeVar *} /* --- Bison: %type => C type: IntoClause * --- */ %type into_clause {IntoClause *} %type create_as_target {IntoClause *} %type create_mv_target {IntoClause *} /* --- Bison: %type => C type: DefElem * --- */ %type createfunc_opt_item {DefElem *} %type common_func_opt_item {DefElem *} %type dostmt_opt_item {DefElem *} /* --- Bison: %type => C type: FunctionParameter * --- */ %type func_arg {FunctionParameter *} %type func_arg_with_default {FunctionParameter *} %type table_func_column {FunctionParameter *} %type aggr_arg {FunctionParameter *} /* --- Bison: %type => C type: FunctionParameterMode --- */ %type arg_class {FunctionParameterMode} /* --- Bison: %type => C type: TypeName * --- */ %type func_return {TypeName *} %type func_type {TypeName *} /* --- Bison: %type => C type: bool --- */ %type opt_trusted {bool} %type opt_restart_seqs {bool} /* --- Bison: %type => C type: int --- */ %type optTemp {int} %type optNoLog {int} /* --- Bison: %type => C type: OnCommitAction --- */ %type onCommitOption {OnCommitAction} /* --- Bison: %type => C type: int --- */ %type for_locking_strength {int} %type opt_for_locking_strength {int} /* --- Bison: %type => C type: Node * --- */ %type for_locking_item {Node *} /* --- Bison: %type => C type: List * --- */ %type for_locking_clause {List *} %type opt_for_locking_clause {List *} %type for_locking_items {List *} %type locked_rels_list {List *} /* --- Bison: %type => C type: SetQuantifier --- */ %type set_quantifier {SetQuantifier} /* --- Bison: %type => C type: Node * --- */ %type join_qual {Node *} /* --- Bison: %type => C type: JoinType --- */ %type join_type {JoinType} /* --- Bison: %type => C type: List * --- */ %type extract_list {List *} %type overlay_list {List *} %type position_list {List *} %type substr_list {List *} %type trim_list {List *} %type opt_interval {List *} %type interval_second {List *} /* --- Bison: %type => C type: char * --- */ %type unicode_normal_form {char *} /* --- Bison: %type => C type: bool --- */ %type opt_instead {bool} %type opt_unique {bool} %type opt_verbose {bool} %type opt_full {bool} %type opt_freeze {bool} %type opt_analyze {bool} %type opt_default {bool} /* --- Bison: %type => C type: DefElem * --- */ %type opt_binary {DefElem *} %type copy_delimiter {DefElem *} /* --- Bison: %type => C type: bool --- */ %type copy_from {bool} %type opt_program {bool} /* --- Bison: %type => C type: int --- */ %type event {int} %type cursor_options {int} %type opt_hold {int} %type opt_set_data {int} /* --- Bison: %type => C type: ObjectType --- */ %type object_type_any_name {ObjectType} %type object_type_name {ObjectType} %type object_type_name_on_any_name {ObjectType} %type drop_type_name {ObjectType} /* --- Bison: %type => C type: Node * --- */ %type fetch_args {Node *} %type select_limit_value {Node *} %type offset_clause {Node *} %type select_offset_value {Node *} %type select_fetch_first_value {Node *} %type i_or_F_const {Node *} /* --- Bison: %type => C type: int --- */ %type row_or_rows {int} %type first_or_next {int} /* --- Bison: %type => C type: List * --- */ %type optSeqOptList {List *} %type seqOptList {List *} %type optParenthesizedSeqOptList {List *} /* --- Bison: %type => C type: DefElem * --- */ %type seqOptElem {DefElem *} /* --- Bison: %type => C type: insertStmt * --- */ %type insert_rest {insertStmt *} /* --- Bison: %type => C type: InferClause * --- */ %type opt_conf_expr {InferClause *} /* --- Bison: %type => C type: OnConflictClause * --- */ %type opt_on_conflict {OnConflictClause *} /* --- Bison: %type => C type: MergeWhenClause * --- */ %type merge_insert {MergeWhenClause *} %type merge_update {MergeWhenClause *} %type merge_delete {MergeWhenClause *} /* --- Bison: %type => C type: MergeMatchKind --- */ %type merge_when_tgt_matched {MergeMatchKind} %type merge_when_tgt_not_matched {MergeMatchKind} /* --- Bison: %type => C type: Node * --- */ %type merge_when_clause {Node *} %type opt_merge_when_condition {Node *} /* --- Bison: %type => C type: List * --- */ %type merge_when_list {List *} /* --- Bison: %type => C type: variableSetStmt * --- */ %type generic_set {variableSetStmt *} %type set_rest {variableSetStmt *} %type set_rest_more {variableSetStmt *} %type generic_reset {variableSetStmt *} %type reset_rest {variableSetStmt *} %type setResetClause {variableSetStmt *} %type functionSetResetClause {variableSetStmt *} /* --- Bison: %type => C type: Node * --- */ %type tableElement {Node *} %type typedTableElement {Node *} %type constraintElem {Node *} %type domainConstraintElem {Node *} %type tableFuncElement {Node *} %type columnDef {Node *} %type columnOptions {Node *} %type optionalPeriodName {Node *} /* --- Bison: %type => C type: DefElem * --- */ %type def_elem {DefElem *} %type reloption_elem {DefElem *} %type old_aggr_elem {DefElem *} %type operator_def_elem {DefElem *} /* --- Bison: %type => C type: Node * --- */ %type def_arg {Node *} %type columnElem {Node *} %type where_clause {Node *} %type where_or_current_clause {Node *} %type a_expr {Node *} %type b_expr {Node *} %type c_expr {Node *} %type aexprConst {Node *} %type indirection_el {Node *} %type opt_slice_bound {Node *} %type columnref {Node *} %type having_clause {Node *} %type func_table {Node *} %type xmltable {Node *} %type array_expr {Node *} %type optWhereClause {Node *} %type operator_def_arg {Node *} /* --- Bison: %type => C type: List * --- */ %type opt_column_and_period_list {List *} %type rowsfrom_item {List *} %type rowsfrom_list {List *} %type opt_col_def_list {List *} /* --- Bison: %type => C type: bool --- */ %type opt_ordinality {bool} %type opt_without_overlaps {bool} /* --- Bison: %type => C type: List * --- */ %type exclusionConstraintList {List *} %type exclusionConstraintElem {List *} %type func_arg_list {List *} %type func_arg_list_opt {List *} /* --- Bison: %type => C type: Node * --- */ %type func_arg_expr {Node *} /* --- Bison: %type => C type: List * --- */ %type row {List *} %type explicit_row {List *} %type implicit_row {List *} %type type_list {List *} %type array_expr_list {List *} /* --- Bison: %type => C type: Node * --- */ %type case_expr {Node *} %type case_arg {Node *} %type when_clause {Node *} %type case_default {Node *} /* --- Bison: %type => C type: List * --- */ %type when_clause_list {List *} /* --- Bison: %type => C type: Node * --- */ %type opt_search_clause {Node *} %type opt_cycle_clause {Node *} /* --- Bison: %type => C type: int --- */ %type sub_type {int} %type opt_materialized {int} /* --- Bison: %type => C type: Node * --- */ %type numericOnly {Node *} /* --- Bison: %type => C type: List * --- */ %type numericOnly_list {List *} /* --- Bison: %type => C type: Alias * --- */ %type alias_clause {Alias *} %type opt_alias_clause {Alias *} %type opt_alias_clause_for_join_using {Alias *} /* --- Bison: %type => C type: List * --- */ %type func_alias_clause {List *} /* --- Bison: %type => C type: SortBy * --- */ %type sortby {SortBy *} /* --- Bison: %type => C type: IndexElem * --- */ %type index_elem {IndexElem *} %type index_elem_options {IndexElem *} /* --- Bison: %type => C type: StatsElem * --- */ %type stats_param {StatsElem *} /* --- Bison: %type => C type: Node * --- */ %type table_ref {Node *} /* --- Bison: %type => C type: JoinExpr * --- */ %type joined_table {JoinExpr *} /* --- Bison: %type => C type: RangeVar * --- */ %type relation_expr {RangeVar *} %type extended_relation_expr {RangeVar *} %type relation_expr_opt_alias {RangeVar *} /* --- Bison: %type => C type: Node * --- */ %type tablesample_clause {Node *} %type opt_repeatable_clause {Node *} /* --- Bison: %type => C type: ResTarget * --- */ %type target_el {ResTarget *} %type set_target {ResTarget *} %type insert_column_item {ResTarget *} /* --- Bison: %type => C type: char * --- */ %type generic_option_name {char *} /* --- Bison: %type => C type: Node * --- */ %type generic_option_arg {Node *} /* --- Bison: %type => C type: DefElem * --- */ %type generic_option_elem {DefElem *} %type alter_generic_option_elem {DefElem *} /* --- Bison: %type => C type: List * --- */ %type generic_option_list {List *} %type alter_generic_option_list {List *} /* --- Bison: %type => C type: int --- */ %type reindex_target_relation {int} %type reindex_target_all {int} /* --- Bison: %type => C type: Node * --- */ %type copy_generic_opt_arg {Node *} %type copy_generic_opt_arg_list_item {Node *} /* --- Bison: %type => C type: DefElem * --- */ %type copy_generic_opt_elem {DefElem *} /* --- Bison: %type => C type: List * --- */ %type copy_generic_opt_list {List *} %type copy_generic_opt_arg_list {List *} %type copy_options {List *} /* --- Bison: %type => C type: TypeName * --- */ %type typename {TypeName *} %type simpleTypename {TypeName *} %type constTypename {TypeName *} %type genericType {TypeName *} %type numeric {TypeName *} %type opt_float {TypeName *} %type jsonType {TypeName *} %type character_tn {TypeName *} %type constCharacter {TypeName *} %type characterWithLength {TypeName *} %type characterWithoutLength {TypeName *} %type constDatetime {TypeName *} %type constInterval {TypeName *} %type bit {TypeName *} %type constBit {TypeName *} %type bitWithLength {TypeName *} %type bitWithoutLength {TypeName *} /* --- Bison: %type => C type: char * --- */ %type character {char *} %type extract_arg {char *} /* --- Bison: %type => C type: bool --- */ %type opt_varying {bool} %type opt_timezone {bool} %type opt_no_inherit {bool} /* --- Bison: %type => C type: int --- */ %type iconst {int} %type signedIconst {int} /* --- Bison: %type => C type: char * --- */ %type sconst {char *} %type comment_text {char *} %type notify_payload {char *} %type roleId {char *} %type opt_boolean_or_string {char *} /* --- Bison: %type => C type: List * --- */ %type var_list {List *} /* --- Bison: %type => C type: char * --- */ %type colId {char *} %type colLabel {char *} %type bareColLabel {char *} %type nonReservedWord {char *} %type nonReservedWord_or_Sconst {char *} %type var_name {char *} %type type_function_name {char *} %type param_name {char *} %type createdb_opt_name {char *} %type plassign_target {char *} /* --- Bison: %type => C type: Node * --- */ %type var_value {Node *} %type zone_value {Node *} /* --- Bison: %type => C type: roleSpec * --- */ %type auth_ident {roleSpec *} %type roleSpec {roleSpec *} %type opt_granted_by {roleSpec *} /* --- Bison: %type => C type: publicationObjSpec * --- */ %type publicationObjSpec {publicationObjSpec *} %type publicationExceptObjSpec {publicationObjSpec *} /* --- Bison: %type => C type: publicationAllObjSpec * --- */ %type publicationAllObjSpec {publicationAllObjSpec *} /* --- Bison: %type => C type: const char * --- */ %type unreserved_keyword {const char *} %type type_func_name_keyword {const char *} %type col_name_keyword {const char *} %type reserved_keyword {const char *} %type bare_label_keyword {const char *} /* --- Bison: %type => C type: Node * --- */ %type domainConstraint {Node *} %type tableConstraint {Node *} %type tableLikeClause {Node *} /* --- Bison: %type => C type: int --- */ %type tableLikeOptionList {int} %type tableLikeOption {int} /* --- Bison: %type => C type: char * --- */ %type column_compression {char *} %type opt_column_compression {char *} %type column_storage {char *} %type opt_column_storage {char *} /* --- Bison: %type => C type: List * --- */ %type colQualList {List *} /* --- Bison: %type => C type: Node * --- */ %type colConstraint {Node *} %type colConstraintElem {Node *} %type constraintAttr {Node *} /* --- Bison: %type => C type: int --- */ %type key_match {int} /* --- Bison: %type => C type: struct KeyAction * --- */ %type key_delete {struct KeyAction *} %type key_update {struct KeyAction *} %type key_action {struct KeyAction *} /* --- Bison: %type => C type: struct KeyActions * --- */ %type key_actions {struct KeyActions *} /* --- Bison: %type => C type: int --- */ %type constraintAttributeSpec {int} %type constraintAttributeElem {int} /* --- Bison: %type => C type: char * --- */ %type existingIndex {char *} /* --- Bison: %type => C type: List * --- */ %type constraints_set_list {List *} /* --- Bison: %type => C type: bool --- */ %type constraints_set_mode {bool} /* --- Bison: %type => C type: char * --- */ %type optTableSpace {char *} %type optConsTableSpace {char *} /* --- Bison: %type => C type: roleSpec * --- */ %type optTableSpaceOwner {roleSpec *} /* --- Bison: %type => C type: int --- */ %type opt_check_option {int} /* --- Bison: %type => C type: char * --- */ %type opt_provider {char *} %type security_label {char *} /* --- Bison: %type => C type: ResTarget * --- */ %type labeled_expr {ResTarget *} /* --- Bison: %type => C type: List * --- */ %type labeled_expr_list {List *} %type xml_attributes {List *} /* --- Bison: %type => C type: Node * --- */ %type xml_root_version {Node *} %type opt_xml_root_standalone {Node *} %type xmlexists_argument {Node *} /* --- Bison: %type => C type: int --- */ %type document_or_content {int} /* --- Bison: %type => C type: bool --- */ %type xml_indent_option {bool} %type xml_whitespace_option {bool} /* --- Bison: %type => C type: List * --- */ %type xmltable_column_list {List *} %type xmltable_column_option_list {List *} /* --- Bison: %type => C type: Node * --- */ %type xmltable_column_el {Node *} /* --- Bison: %type => C type: DefElem * --- */ %type xmltable_column_option_el {DefElem *} /* --- Bison: %type => C type: List * --- */ %type xml_namespace_list {List *} /* --- Bison: %type => C type: ResTarget * --- */ %type xml_namespace_el {ResTarget *} /* --- Bison: %type => C type: Node * --- */ %type func_application {Node *} %type func_expr_common_subexpr {Node *} %type func_expr {Node *} %type func_expr_windowless {Node *} %type common_table_expr {Node *} /* --- Bison: %type => C type: WithClause * --- */ %type with_clause {WithClause *} %type opt_with_clause {WithClause *} /* --- Bison: %type => C type: List * --- */ %type cte_list {List *} %type within_group_clause {List *} /* --- Bison: %type => C type: Node * --- */ %type filter_clause {Node *} /* --- Bison: %type => C type: List * --- */ %type window_clause {List *} %type window_definition_list {List *} %type opt_partition_clause {List *} /* --- Bison: %type => C type: WindowDef * --- */ %type window_definition {WindowDef *} %type over_clause {WindowDef *} %type window_specification {WindowDef *} %type opt_frame_clause {WindowDef *} %type frame_extent {WindowDef *} %type frame_bound {WindowDef *} /* --- Bison: %type => C type: int --- */ %type null_treatment {int} %type opt_window_exclusion_clause {int} /* --- Bison: %type => C type: char * --- */ %type opt_existing_window_name {char *} /* --- Bison: %type => C type: bool --- */ %type opt_if_not_exists {bool} %type opt_unique_null_treatment {bool} /* --- Bison: %type => C type: int --- */ %type generated_when {int} %type override_kind {int} %type opt_virtual_or_stored {int} /* --- Bison: %type => C type: partitionSpec * --- */ %type partitionSpec {partitionSpec *} %type optPartitionSpec {partitionSpec *} /* --- Bison: %type => C type: PartitionElem * --- */ %type part_elem {PartitionElem *} /* --- Bison: %type => C type: List * --- */ %type part_params {List *} /* --- Bison: %type => C type: partitionBoundSpec * --- */ %type partitionBoundSpec {partitionBoundSpec *} /* --- Bison: %type => C type: singlePartitionSpec * --- */ %type singlePartitionSpec {singlePartitionSpec *} /* --- Bison: %type => C type: List * --- */ %type partitions_list {List *} %type hash_partbound {List *} /* --- Bison: %type => C type: DefElem * --- */ %type hash_partbound_elem {DefElem *} /* --- Bison: %type => C type: Node * --- */ %type json_format_clause {Node *} %type json_format_clause_opt {Node *} %type json_value_expr {Node *} %type json_returning_clause_opt {Node *} %type json_name_and_value {Node *} %type json_aggregate_func {Node *} %type json_argument {Node *} %type json_behavior {Node *} %type json_on_error_clause_opt {Node *} %type json_table {Node *} %type json_table_column_definition {Node *} %type json_table_column_path_clause_opt {Node *} /* --- Bison: %type => C type: List * --- */ %type json_name_and_value_list {List *} %type json_value_expr_list {List *} %type json_array_aggregate_order_by_clause_opt {List *} %type json_arguments {List *} %type json_behavior_clause_opt {List *} %type json_passing_clause_opt {List *} %type json_table_column_definition_list {List *} /* --- Bison: %type => C type: char * --- */ %type json_table_path_name_opt {char *} /* --- Bison: %type => C type: int --- */ %type json_behavior_type {int} %type json_predicate_type_constraint {int} %type json_quotes_clause_opt {int} %type json_wrapper_behavior {int} /* --- Bison: %type => C type: bool --- */ %type json_key_uniqueness_constraint_opt {bool} %type json_object_constructor_null_clause_opt {bool} %type json_array_constructor_null_clause_opt {bool} /* --- Bison: %type => C type: List * --- */ %type vertex_tables_clause {List *} %type edge_tables_clause {List *} %type opt_vertex_tables_clause {List *} %type opt_edge_tables_clause {List *} %type vertex_table_list {List *} %type opt_graph_table_key_clause {List *} %type edge_table_list {List *} %type source_vertex_table {List *} %type destination_vertex_table {List *} %type opt_element_table_label_and_properties {List *} %type label_and_properties_list {List *} %type add_label_list {List *} /* --- Bison: %type => C type: Node * --- */ %type vertex_table_definition {Node *} %type edge_table_definition {Node *} /* --- Bison: %type => C type: Alias * --- */ %type opt_propgraph_table_alias {Alias *} /* --- Bison: %type => C type: char * --- */ %type element_table_label_clause {char *} /* --- Bison: %type => C type: Node * --- */ %type label_and_properties {Node *} %type element_table_properties {Node *} %type add_label {Node *} /* --- Bison: %type => C type: int --- */ %type vertex_or_edge {int} /* --- Bison: %type => C type: List * --- */ %type opt_graph_pattern_quantifier {List *} %type path_pattern_list {List *} %type path_pattern {List *} %type path_pattern_expression {List *} %type path_term {List *} /* --- Bison: %type => C type: Node * --- */ %type graph_pattern {Node *} %type path_factor {Node *} %type path_primary {Node *} %type opt_is_label_expression {Node *} %type label_expression {Node *} %type label_disjunction {Node *} %type label_term {Node *} /* --- Bison: %type => C type: char * --- */ %type opt_colid {char *} /* ----- parse_toplevel ----- */ parse_toplevel(A) ::= stmtmulti(B). { pg_yyget_extra(yyscanner)->parsetree = B; (void) yynerrs; } parse_toplevel(A) ::= MODE_TYPE_NAME typename(C). { pg_yyget_extra(yyscanner)->parsetree = list_make1(C); } parse_toplevel(A) ::= MODE_PLPGSQL_EXPR pLpgSQL_Expr(C). { pg_yyget_extra(yyscanner)->parsetree = list_make1(makeRawStmt(C, LOC(C))); } parse_toplevel(A) ::= MODE_PLPGSQL_ASSIGN1 pLAssignStmt(C). { pLAssignStmt *n = (pLAssignStmt *) C; n->nnames = 1; pg_yyget_extra(yyscanner)->parsetree = list_make1(makeRawStmt((Node *) n, LOC(C))); } parse_toplevel(A) ::= MODE_PLPGSQL_ASSIGN2 pLAssignStmt(C). { pLAssignStmt *n = (pLAssignStmt *) C; n->nnames = 2; pg_yyget_extra(yyscanner)->parsetree = list_make1(makeRawStmt((Node *) n, LOC(C))); } parse_toplevel(A) ::= MODE_PLPGSQL_ASSIGN3 pLAssignStmt(C). { pLAssignStmt *n = (pLAssignStmt *) C; n->nnames = 3; pg_yyget_extra(yyscanner)->parsetree = list_make1(makeRawStmt((Node *) n, LOC(C))); } /* ----- stmtmulti ----- */ stmtmulti(A) ::= stmtmulti(B) SEMICOLON toplevel_stmt(D). { if (B != NIL) { updateRawStmtEnd(llast_node(RawStmt, B), LOC(C)); } if (D != NULL) A = lappend(B, makeRawStmt(D, LOC(D))); else A = B; } stmtmulti(A) ::= toplevel_stmt(B). { if (B != NULL) A = list_make1(makeRawStmt(B, LOC(B))); else A = NIL; } /* ----- toplevel_stmt ----- */ toplevel_stmt(A) ::= stmt(B). toplevel_stmt(A) ::= transactionStmtLegacy(B). /* ----- stmt ----- */ stmt(A) ::= alterEventTrigStmt(B). stmt(A) ::= alterCollationStmt(B). stmt(A) ::= alterDatabaseStmt(B). stmt(A) ::= alterDatabaseSetStmt(B). stmt(A) ::= alterDefaultPrivilegesStmt(B). stmt(A) ::= alterDomainStmt(B). stmt(A) ::= alterEnumStmt(B). stmt(A) ::= alterExtensionStmt(B). stmt(A) ::= alterExtensionContentsStmt(B). stmt(A) ::= alterFdwStmt(B). stmt(A) ::= alterForeignServerStmt(B). stmt(A) ::= alterFunctionStmt(B). stmt(A) ::= alterGroupStmt(B). stmt(A) ::= alterObjectDependsStmt(B). stmt(A) ::= alterObjectSchemaStmt(B). stmt(A) ::= alterOwnerStmt(B). stmt(A) ::= alterOperatorStmt(B). stmt(A) ::= alterTypeStmt(B). stmt(A) ::= alterPolicyStmt(B). stmt(A) ::= alterPropGraphStmt(B). stmt(A) ::= alterSeqStmt(B). stmt(A) ::= alterSystemStmt(B). stmt(A) ::= alterTableStmt(B). stmt(A) ::= alterTblSpcStmt(B). stmt(A) ::= alterCompositeTypeStmt(B). stmt(A) ::= alterPublicationStmt(B). stmt(A) ::= alterRoleSetStmt(B). stmt(A) ::= alterRoleStmt(B). stmt(A) ::= alterSubscriptionStmt(B). stmt(A) ::= alterStatsStmt(B). stmt(A) ::= alterTSConfigurationStmt(B). stmt(A) ::= alterTSDictionaryStmt(B). stmt(A) ::= alterUserMappingStmt(B). stmt(A) ::= analyzeStmt(B). stmt(A) ::= callStmt(B). stmt(A) ::= checkPointStmt(B). stmt(A) ::= closePortalStmt(B). stmt(A) ::= commentStmt(B). stmt(A) ::= constraintsSetStmt(B). stmt(A) ::= copyStmt(B). stmt(A) ::= createAmStmt(B). stmt(A) ::= createAsStmt(B). stmt(A) ::= createAssertionStmt(B). stmt(A) ::= createCastStmt(B). stmt(A) ::= createConversionStmt(B). stmt(A) ::= createDomainStmt(B). stmt(A) ::= createExtensionStmt(B). stmt(A) ::= createFdwStmt(B). stmt(A) ::= createForeignServerStmt(B). stmt(A) ::= createForeignTableStmt(B). stmt(A) ::= createFunctionStmt(B). stmt(A) ::= createGroupStmt(B). stmt(A) ::= createMatViewStmt(B). stmt(A) ::= createOpClassStmt(B). stmt(A) ::= createOpFamilyStmt(B). stmt(A) ::= createPublicationStmt(B). stmt(A) ::= alterOpFamilyStmt(B). stmt(A) ::= createPolicyStmt(B). stmt(A) ::= createPLangStmt(B). stmt(A) ::= createPropGraphStmt(B). stmt(A) ::= createSchemaStmt(B). stmt(A) ::= createSeqStmt(B). stmt(A) ::= createStmt(B). stmt(A) ::= createSubscriptionStmt(B). stmt(A) ::= createStatsStmt(B). stmt(A) ::= createTableSpaceStmt(B). stmt(A) ::= createTransformStmt(B). stmt(A) ::= createTrigStmt(B). stmt(A) ::= createEventTrigStmt(B). stmt(A) ::= createRoleStmt(B). stmt(A) ::= createUserStmt(B). stmt(A) ::= createUserMappingStmt(B). stmt(A) ::= createdbStmt(B). stmt(A) ::= deallocateStmt(B). stmt(A) ::= declareCursorStmt(B). stmt(A) ::= defineStmt(B). stmt(A) ::= deleteStmt(B). stmt(A) ::= discardStmt(B). stmt(A) ::= doStmt(B). stmt(A) ::= dropCastStmt(B). stmt(A) ::= dropOpClassStmt(B). stmt(A) ::= dropOpFamilyStmt(B). stmt(A) ::= dropOwnedStmt(B). stmt(A) ::= dropStmt(B). stmt(A) ::= dropSubscriptionStmt(B). stmt(A) ::= dropTableSpaceStmt(B). stmt(A) ::= dropTransformStmt(B). stmt(A) ::= dropRoleStmt(B). stmt(A) ::= dropUserMappingStmt(B). stmt(A) ::= dropdbStmt(B). stmt(A) ::= executeStmt(B). stmt(A) ::= explainStmt(B). stmt(A) ::= fetchStmt(B). stmt(A) ::= grantStmt(B). stmt(A) ::= grantRoleStmt(B). stmt(A) ::= importForeignSchemaStmt(B). stmt(A) ::= indexStmt(B). stmt(A) ::= insertStmt(B). stmt(A) ::= listenStmt(B). stmt(A) ::= refreshMatViewStmt(B). stmt(A) ::= loadStmt(B). stmt(A) ::= lockStmt(B). stmt(A) ::= mergeStmt(B). stmt(A) ::= notifyStmt(B). stmt(A) ::= prepareStmt(B). stmt(A) ::= reassignOwnedStmt(B). stmt(A) ::= reindexStmt(B). stmt(A) ::= removeAggrStmt(B). stmt(A) ::= removeFuncStmt(B). stmt(A) ::= removeOperStmt(B). stmt(A) ::= renameStmt(B). stmt(A) ::= repackStmt(B). stmt(A) ::= revokeStmt(B). stmt(A) ::= revokeRoleStmt(B). stmt(A) ::= ruleStmt(B). stmt(A) ::= secLabelStmt(B). stmt(A) ::= selectStmt(B). stmt(A) ::= transactionStmt(B). stmt(A) ::= truncateStmt(B). stmt(A) ::= unlistenStmt(B). stmt(A) ::= updateStmt(B). stmt(A) ::= vacuumStmt(B). stmt(A) ::= variableResetStmt(B). stmt(A) ::= variableSetStmt(B). stmt(A) ::= variableShowStmt(B). stmt(A) ::= viewStmt(B). stmt(A) ::= waitStmt(B). stmt(A) ::= . { A = NULL; } /* ----- opt_single_name ----- */ opt_single_name(A) ::= colId(B). { A = B; } opt_single_name(A) ::= . { A = NULL; } /* ----- opt_qualified_name ----- */ opt_qualified_name(A) ::= any_name(B). { A = B; } opt_qualified_name(A) ::= . { A = NIL; } /* ----- opt_concurrently ----- */ opt_concurrently(A) ::= CONCURRENTLY. { A = true; } opt_concurrently(A) ::= . { A = false; } /* ----- opt_usingindex ----- */ opt_usingindex(A) ::= USING INDEX. { A = true; } opt_usingindex(A) ::= . { A = false; } /* ----- opt_drop_behavior ----- */ opt_drop_behavior(A) ::= CASCADE. { A = DROP_CASCADE; } opt_drop_behavior(A) ::= RESTRICT. { A = DROP_RESTRICT; } opt_drop_behavior(A) ::= . { A = DROP_RESTRICT; } /* ----- opt_utility_option_list ----- */ opt_utility_option_list(A) ::= LPAREN utility_option_list(C) RPAREN. { A = C; } opt_utility_option_list(A) ::= . { A = NULL; } /* ----- utility_option_list ----- */ utility_option_list(A) ::= utility_option_elem(B). { A = list_make1(B); } utility_option_list(A) ::= utility_option_list(B) COMMA utility_option_elem(D). { A = lappend(B, D); } /* ----- utility_option_elem ----- */ utility_option_elem(A) ::= utility_option_name(B) utility_option_arg(C). { A = makeDefElem(B, C, LOC(B)); } /* ----- utility_option_name ----- */ utility_option_name(A) ::= nonReservedWord(B). { A = B; } utility_option_name(A) ::= analyze_keyword(B). { A = "analyze"; } utility_option_name(A) ::= FORMAT_LA. { A = "format"; } /* ----- utility_option_arg ----- */ utility_option_arg(A) ::= opt_boolean_or_string(B). { A = (Node *) makeString(B); } utility_option_arg(A) ::= numericOnly(B). { A = (Node *) B; } utility_option_arg(A) ::= . { A = NULL; } /* ----- callStmt ----- */ callStmt(A) ::= CALL func_application(C). { callStmt *n = makeNode(callStmt); n->funccall = castNode(FuncCall, C); A = (Node *) n; } /* ----- createRoleStmt ----- */ createRoleStmt(A) ::= CREATE ROLE roleId(D) opt_with(E) optRoleList(F). { createRoleStmt *n = makeNode(createRoleStmt); n->stmt_type = ROLESTMT_ROLE; n->role = D; n->options = F; A = (Node *) n; } /* ----- opt_with ----- */ opt_with(A) ::= WITH. opt_with(A) ::= WITH_LA. /* ----- optRoleList ----- */ optRoleList(A) ::= optRoleList(B) createOptRoleElem(C). { A = lappend(B, C); } optRoleList(A) ::= . { A = NIL; } /* ----- alterOptRoleList ----- */ alterOptRoleList(A) ::= alterOptRoleList(B) alterOptRoleElem(C). { A = lappend(B, C); } alterOptRoleList(A) ::= . { A = NIL; } /* ----- alterOptRoleElem ----- */ alterOptRoleElem(A) ::= PASSWORD sconst(C). { A = makeDefElem("password", (Node *) makeString(C), LOC(B)); } alterOptRoleElem(A) ::= PASSWORD NULL_P. { A = makeDefElem("password", NULL, LOC(B)); } alterOptRoleElem(A) ::= ENCRYPTED PASSWORD sconst(D). { A = makeDefElem("password", (Node *) makeString(D), LOC(B)); } alterOptRoleElem(A) ::= UNENCRYPTED PASSWORD sconst(D). { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("UNENCRYPTED PASSWORD is no longer supported"), errhint("Remove UNENCRYPTED to store the password in encrypted form instead."), parser_errposition(LOC(B)))); } alterOptRoleElem(A) ::= INHERIT. { A = makeDefElem("inherit", (Node *) makeBoolean(true), LOC(B)); } alterOptRoleElem(A) ::= CONNECTION LIMIT signedIconst(D). { A = makeDefElem("connectionlimit", (Node *) makeInteger(D), LOC(B)); } alterOptRoleElem(A) ::= VALID UNTIL sconst(D). { A = makeDefElem("validUntil", (Node *) makeString(D), LOC(B)); } alterOptRoleElem(A) ::= USER role_list(C). { A = makeDefElem("rolemembers", (Node *) C, LOC(B)); } alterOptRoleElem(A) ::= IDENT. { if (strcmp(B, "superuser") == 0) A = makeDefElem("superuser", (Node *) makeBoolean(true), LOC(B)); else if (strcmp(B, "nosuperuser") == 0) A = makeDefElem("superuser", (Node *) makeBoolean(false), LOC(B)); else if (strcmp(B, "createrole") == 0) A = makeDefElem("createrole", (Node *) makeBoolean(true), LOC(B)); else if (strcmp(B, "nocreaterole") == 0) A = makeDefElem("createrole", (Node *) makeBoolean(false), LOC(B)); else if (strcmp(B, "replication") == 0) A = makeDefElem("isreplication", (Node *) makeBoolean(true), LOC(B)); else if (strcmp(B, "noreplication") == 0) A = makeDefElem("isreplication", (Node *) makeBoolean(false), LOC(B)); else if (strcmp(B, "createdb") == 0) A = makeDefElem("createdb", (Node *) makeBoolean(true), LOC(B)); else if (strcmp(B, "nocreatedb") == 0) A = makeDefElem("createdb", (Node *) makeBoolean(false), LOC(B)); else if (strcmp(B, "login") == 0) A = makeDefElem("canlogin", (Node *) makeBoolean(true), LOC(B)); else if (strcmp(B, "nologin") == 0) A = makeDefElem("canlogin", (Node *) makeBoolean(false), LOC(B)); else if (strcmp(B, "bypassrls") == 0) A = makeDefElem("bypassrls", (Node *) makeBoolean(true), LOC(B)); else if (strcmp(B, "nobypassrls") == 0) A = makeDefElem("bypassrls", (Node *) makeBoolean(false), LOC(B)); else if (strcmp(B, "noinherit") == 0) { A = makeDefElem("inherit", (Node *) makeBoolean(false), LOC(B)); } else ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("unrecognized role option \"%s\"", B), parser_errposition(LOC(B)))); } /* ----- createOptRoleElem ----- */ createOptRoleElem(A) ::= alterOptRoleElem(B). { A = B; } createOptRoleElem(A) ::= SYSID iconst(C). { A = makeDefElem("sysid", (Node *) makeInteger(C), LOC(B)); } createOptRoleElem(A) ::= ADMIN role_list(C). { A = makeDefElem("adminmembers", (Node *) C, LOC(B)); } createOptRoleElem(A) ::= ROLE role_list(C). { A = makeDefElem("rolemembers", (Node *) C, LOC(B)); } createOptRoleElem(A) ::= IN_P ROLE role_list(D). { A = makeDefElem("addroleto", (Node *) D, LOC(B)); } createOptRoleElem(A) ::= IN_P GROUP_P role_list(D). { A = makeDefElem("addroleto", (Node *) D, LOC(B)); } /* ----- createUserStmt ----- */ createUserStmt(A) ::= CREATE USER roleId(D) opt_with(E) optRoleList(F). { createRoleStmt *n = makeNode(createRoleStmt); n->stmt_type = ROLESTMT_USER; n->role = D; n->options = F; A = (Node *) n; } /* ----- alterRoleStmt ----- */ alterRoleStmt(A) ::= ALTER ROLE roleSpec(D) opt_with(E) alterOptRoleList(F). { alterRoleStmt *n = makeNode(alterRoleStmt); n->role = D; n->action = +1; n->options = F; A = (Node *) n; } alterRoleStmt(A) ::= ALTER USER roleSpec(D) opt_with(E) alterOptRoleList(F). { alterRoleStmt *n = makeNode(alterRoleStmt); n->role = D; n->action = +1; n->options = F; A = (Node *) n; } /* ----- opt_in_database ----- */ opt_in_database(A) ::= . { A = NULL; } opt_in_database(A) ::= IN_P DATABASE name(D). { A = D; } /* ----- alterRoleSetStmt ----- */ alterRoleSetStmt(A) ::= ALTER ROLE roleSpec(D) opt_in_database(E) setResetClause(F). { alterRoleSetStmt *n = makeNode(alterRoleSetStmt); n->role = D; n->database = E; n->setstmt = F; A = (Node *) n; } alterRoleSetStmt(A) ::= ALTER ROLE ALL opt_in_database(E) setResetClause(F). { alterRoleSetStmt *n = makeNode(alterRoleSetStmt); n->role = NULL; n->database = E; n->setstmt = F; A = (Node *) n; } alterRoleSetStmt(A) ::= ALTER USER roleSpec(D) opt_in_database(E) setResetClause(F). { alterRoleSetStmt *n = makeNode(alterRoleSetStmt); n->role = D; n->database = E; n->setstmt = F; A = (Node *) n; } alterRoleSetStmt(A) ::= ALTER USER ALL opt_in_database(E) setResetClause(F). { alterRoleSetStmt *n = makeNode(alterRoleSetStmt); n->role = NULL; n->database = E; n->setstmt = F; A = (Node *) n; } /* ----- dropRoleStmt ----- */ dropRoleStmt(A) ::= DROP ROLE role_list(D). { dropRoleStmt *n = makeNode(dropRoleStmt); n->missing_ok = false; n->roles = D; A = (Node *) n; } dropRoleStmt(A) ::= DROP ROLE IF_P EXISTS role_list(F). { dropRoleStmt *n = makeNode(dropRoleStmt); n->missing_ok = true; n->roles = F; A = (Node *) n; } dropRoleStmt(A) ::= DROP USER role_list(D). { dropRoleStmt *n = makeNode(dropRoleStmt); n->missing_ok = false; n->roles = D; A = (Node *) n; } dropRoleStmt(A) ::= DROP USER IF_P EXISTS role_list(F). { dropRoleStmt *n = makeNode(dropRoleStmt); n->roles = F; n->missing_ok = true; A = (Node *) n; } dropRoleStmt(A) ::= DROP GROUP_P role_list(D). { dropRoleStmt *n = makeNode(dropRoleStmt); n->missing_ok = false; n->roles = D; A = (Node *) n; } dropRoleStmt(A) ::= DROP GROUP_P IF_P EXISTS role_list(F). { dropRoleStmt *n = makeNode(dropRoleStmt); n->missing_ok = true; n->roles = F; A = (Node *) n; } /* ----- createGroupStmt ----- */ createGroupStmt(A) ::= CREATE GROUP_P roleId(D) opt_with(E) optRoleList(F). { createRoleStmt *n = makeNode(createRoleStmt); n->stmt_type = ROLESTMT_GROUP; n->role = D; n->options = F; A = (Node *) n; } /* ----- alterGroupStmt ----- */ alterGroupStmt(A) ::= ALTER GROUP_P roleSpec(D) add_drop(E) USER role_list(G). { alterRoleStmt *n = makeNode(alterRoleStmt); n->role = D; n->action = E; n->options = list_make1(makeDefElem("rolemembers", (Node *) G, LOC(G))); A = (Node *) n; } /* ----- add_drop ----- */ add_drop(A) ::= ADD_P. { A = +1; } add_drop(A) ::= DROP. { A = -1; } /* ----- createSchemaStmt ----- */ createSchemaStmt(A) ::= CREATE SCHEMA opt_single_name(D) AUTHORIZATION roleSpec(F) optSchemaEltList(G). { createSchemaStmt *n = makeNode(createSchemaStmt); n->schemaname = D; n->authrole = F; n->schemaElts = G; n->if_not_exists = false; A = (Node *) n; } createSchemaStmt(A) ::= CREATE SCHEMA colId(D) optSchemaEltList(E). { createSchemaStmt *n = makeNode(createSchemaStmt); n->schemaname = D; n->authrole = NULL; n->schemaElts = E; n->if_not_exists = false; A = (Node *) n; } createSchemaStmt(A) ::= CREATE SCHEMA IF_P NOT EXISTS opt_single_name(G) AUTHORIZATION roleSpec(I) optSchemaEltList(J). { createSchemaStmt *n = makeNode(createSchemaStmt); n->schemaname = G; n->authrole = I; if (J != NIL) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("CREATE SCHEMA IF NOT EXISTS cannot include schema elements"), parser_errposition(LOC(J)))); n->schemaElts = J; n->if_not_exists = true; A = (Node *) n; } createSchemaStmt(A) ::= CREATE SCHEMA IF_P NOT EXISTS colId(G) optSchemaEltList(H). { createSchemaStmt *n = makeNode(createSchemaStmt); n->schemaname = G; n->authrole = NULL; if (H != NIL) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("CREATE SCHEMA IF NOT EXISTS cannot include schema elements"), parser_errposition(LOC(H)))); n->schemaElts = H; n->if_not_exists = true; A = (Node *) n; } /* ----- optSchemaEltList ----- */ optSchemaEltList(A) ::= optSchemaEltList(B) schema_stmt(C). { A = lappend(B, C); } optSchemaEltList(A) ::= . { A = NIL; } /* ----- schema_stmt ----- */ schema_stmt(A) ::= createStmt(B). schema_stmt(A) ::= indexStmt(B). schema_stmt(A) ::= createSeqStmt(B). schema_stmt(A) ::= createTrigStmt(B). schema_stmt(A) ::= grantStmt(B). schema_stmt(A) ::= viewStmt(B). /* ----- variableSetStmt ----- */ variableSetStmt(A) ::= SET set_rest(C). { variableSetStmt *n = C; n->is_local = false; A = (Node *) n; } variableSetStmt(A) ::= SET LOCAL set_rest(D). { variableSetStmt *n = D; n->is_local = true; A = (Node *) n; } variableSetStmt(A) ::= SET SESSION set_rest(D). { variableSetStmt *n = D; n->is_local = false; A = (Node *) n; } /* ----- set_rest ----- */ set_rest(A) ::= TRANSACTION transaction_mode_list(C). { variableSetStmt *n = makeNode(variableSetStmt); n->kind = VAR_SET_MULTI; n->name = "TRANSACTION"; n->args = C; n->jumble_args = true; n->location = -1; A = n; } set_rest(A) ::= SESSION CHARACTERISTICS AS TRANSACTION transaction_mode_list(F). { variableSetStmt *n = makeNode(variableSetStmt); n->kind = VAR_SET_MULTI; n->name = "SESSION CHARACTERISTICS"; n->args = F; n->jumble_args = true; n->location = -1; A = n; } set_rest(A) ::= set_rest_more(B). /* ----- generic_set ----- */ generic_set(A) ::= var_name(B) TO var_list(D). { variableSetStmt *n = makeNode(variableSetStmt); n->kind = VAR_SET_VALUE; n->name = B; n->args = D; n->location = LOC(D); A = n; } generic_set(A) ::= var_name(B) EQ var_list(D). { variableSetStmt *n = makeNode(variableSetStmt); n->kind = VAR_SET_VALUE; n->name = B; n->args = D; n->location = LOC(D); A = n; } generic_set(A) ::= var_name(B) TO NULL_P. { variableSetStmt *n = makeNode(variableSetStmt); n->kind = VAR_SET_VALUE; n->name = B; n->args = list_make1(makeNullAConst(LOC(D))); n->location = LOC(D); A = n; } generic_set(A) ::= var_name(B) EQ NULL_P. { variableSetStmt *n = makeNode(variableSetStmt); n->kind = VAR_SET_VALUE; n->name = B; n->args = list_make1(makeNullAConst(LOC(D))); n->location = LOC(D); A = n; } generic_set(A) ::= var_name(B) TO DEFAULT. { variableSetStmt *n = makeNode(variableSetStmt); n->kind = VAR_SET_DEFAULT; n->name = B; n->location = -1; A = n; } generic_set(A) ::= var_name(B) EQ DEFAULT. { variableSetStmt *n = makeNode(variableSetStmt); n->kind = VAR_SET_DEFAULT; n->name = B; n->location = -1; A = n; } /* ----- set_rest_more ----- */ set_rest_more(A) ::= generic_set(B). { A = B; } set_rest_more(A) ::= var_name(B) FROM CURRENT_P. { variableSetStmt *n = makeNode(variableSetStmt); n->kind = VAR_SET_CURRENT; n->name = B; n->location = -1; A = n; } set_rest_more(A) ::= TIME ZONE zone_value(D). { variableSetStmt *n = makeNode(variableSetStmt); n->kind = VAR_SET_VALUE; n->name = "timezone"; n->location = -1; n->jumble_args = true; if (D != NULL) n->args = list_make1(D); else n->kind = VAR_SET_DEFAULT; A = n; } set_rest_more(A) ::= CATALOG_P sconst(C). { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("current database cannot be changed"), parser_errposition(LOC(C)))); A = NULL; } set_rest_more(A) ::= SCHEMA sconst(C). { variableSetStmt *n = makeNode(variableSetStmt); n->kind = VAR_SET_VALUE; n->name = "search_path"; n->args = list_make1(makeStringConst(C, LOC(C))); n->location = LOC(C); A = n; } set_rest_more(A) ::= NAMES opt_encoding(C). { variableSetStmt *n = makeNode(variableSetStmt); n->kind = VAR_SET_VALUE; n->name = "client_encoding"; n->location = LOC(C); if (C != NULL) n->args = list_make1(makeStringConst(C, LOC(C))); else n->kind = VAR_SET_DEFAULT; A = n; } set_rest_more(A) ::= ROLE nonReservedWord_or_Sconst(C). { variableSetStmt *n = makeNode(variableSetStmt); n->kind = VAR_SET_VALUE; n->name = "role"; n->args = list_make1(makeStringConst(C, LOC(C))); n->location = LOC(C); A = n; } set_rest_more(A) ::= SESSION AUTHORIZATION nonReservedWord_or_Sconst(D). { variableSetStmt *n = makeNode(variableSetStmt); n->kind = VAR_SET_VALUE; n->name = "session_authorization"; n->args = list_make1(makeStringConst(D, LOC(D))); n->location = LOC(D); A = n; } set_rest_more(A) ::= SESSION AUTHORIZATION DEFAULT. { variableSetStmt *n = makeNode(variableSetStmt); n->kind = VAR_SET_DEFAULT; n->name = "session_authorization"; n->location = -1; A = n; } set_rest_more(A) ::= XML_P OPTION document_or_content(D). { variableSetStmt *n = makeNode(variableSetStmt); n->kind = VAR_SET_VALUE; n->name = "xmloption"; n->args = list_make1(makeStringConst(D == XMLOPTION_DOCUMENT ? "DOCUMENT" : "CONTENT", LOC(D))); n->jumble_args = true; n->location = -1; A = n; } set_rest_more(A) ::= TRANSACTION SNAPSHOT sconst(D). { variableSetStmt *n = makeNode(variableSetStmt); n->kind = VAR_SET_MULTI; n->name = "TRANSACTION SNAPSHOT"; n->args = list_make1(makeStringConst(D, LOC(D))); n->location = LOC(D); A = n; } /* ----- var_name ----- */ var_name(A) ::= colId(B). { A = B; } var_name(A) ::= var_name(B) DOT colId(D). { A = psprintf("%s.%s", B, D); } /* ----- var_list ----- */ var_list(A) ::= var_value(B). { A = list_make1(B); } var_list(A) ::= var_list(B) COMMA var_value(D). { A = lappend(B, D); } /* ----- var_value ----- */ var_value(A) ::= opt_boolean_or_string(B). { A = makeStringConst(B, LOC(B)); } var_value(A) ::= numericOnly(B). { A = makeAConst(B, LOC(B)); } /* ----- iso_level ----- */ iso_level(A) ::= READ UNCOMMITTED. { A = "read uncommitted"; } iso_level(A) ::= READ COMMITTED. { A = "read committed"; } iso_level(A) ::= REPEATABLE READ. { A = "repeatable read"; } iso_level(A) ::= SERIALIZABLE. { A = "serializable"; } /* ----- opt_boolean_or_string ----- */ opt_boolean_or_string(A) ::= TRUE_P. { A = "true"; } opt_boolean_or_string(A) ::= FALSE_P. { A = "false"; } opt_boolean_or_string(A) ::= ON. { A = "on"; } opt_boolean_or_string(A) ::= nonReservedWord_or_Sconst(B). { A = B; } /* ----- zone_value ----- */ zone_value(A) ::= sconst(B). { A = makeStringConst(B, LOC(B)); } zone_value(A) ::= IDENT. { A = makeStringConst(B, LOC(B)); } zone_value(A) ::= constInterval(B) sconst(C) opt_interval(D). { TypeName *t = B; if (D != NIL) { A_Const *n = (A_Const *) linitial(D); if ((n->val.ival.ival & ~(INTERVAL_MASK(HOUR) | INTERVAL_MASK(MINUTE))) != 0) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("time zone interval must be HOUR or HOUR TO MINUTE"), parser_errposition(LOC(D)))); } t->typmods = D; A = makeStringConstCast(C, LOC(C), t); } zone_value(A) ::= constInterval(B) LPAREN iconst(D) RPAREN sconst(F). { TypeName *t = B; t->typmods = list_make2(makeIntConst(INTERVAL_FULL_RANGE, -1), makeIntConst(D, LOC(D))); A = makeStringConstCast(F, LOC(F), t); } zone_value(A) ::= numericOnly(B). { A = makeAConst(B, LOC(B)); } zone_value(A) ::= DEFAULT. { A = NULL; } zone_value(A) ::= LOCAL. { A = NULL; } /* ----- opt_encoding ----- */ opt_encoding(A) ::= sconst(B). { A = B; } opt_encoding(A) ::= DEFAULT. { A = NULL; } opt_encoding(A) ::= . { A = NULL; } /* ----- nonReservedWord_or_Sconst ----- */ nonReservedWord_or_Sconst(A) ::= nonReservedWord(B). { A = B; } nonReservedWord_or_Sconst(A) ::= sconst(B). { A = B; } /* ----- variableResetStmt ----- */ variableResetStmt(A) ::= RESET reset_rest(C). { A = (Node *) C; } /* ----- reset_rest ----- */ reset_rest(A) ::= generic_reset(B). { A = B; } reset_rest(A) ::= TIME ZONE. { variableSetStmt *n = makeNode(variableSetStmt); n->kind = VAR_RESET; n->name = "timezone"; n->location = -1; A = n; } reset_rest(A) ::= TRANSACTION ISOLATION LEVEL. { variableSetStmt *n = makeNode(variableSetStmt); n->kind = VAR_RESET; n->name = "transaction_isolation"; n->location = -1; A = n; } reset_rest(A) ::= SESSION AUTHORIZATION. { variableSetStmt *n = makeNode(variableSetStmt); n->kind = VAR_RESET; n->name = "session_authorization"; n->location = -1; A = n; } /* ----- generic_reset ----- */ generic_reset(A) ::= var_name(B). { variableSetStmt *n = makeNode(variableSetStmt); n->kind = VAR_RESET; n->name = B; n->location = -1; A = n; } generic_reset(A) ::= ALL. { variableSetStmt *n = makeNode(variableSetStmt); n->kind = VAR_RESET_ALL; n->location = -1; A = n; } /* ----- setResetClause ----- */ setResetClause(A) ::= SET set_rest(C). { A = C; } setResetClause(A) ::= variableResetStmt(B). { A = (variableSetStmt *) B; } /* ----- functionSetResetClause ----- */ functionSetResetClause(A) ::= SET set_rest_more(C). { A = C; } functionSetResetClause(A) ::= variableResetStmt(B). { A = (variableSetStmt *) B; } /* ----- variableShowStmt ----- */ variableShowStmt(A) ::= SHOW var_name(C). { variableShowStmt *n = makeNode(variableShowStmt); n->name = C; A = (Node *) n; } variableShowStmt(A) ::= SHOW TIME ZONE. { variableShowStmt *n = makeNode(variableShowStmt); n->name = "timezone"; A = (Node *) n; } variableShowStmt(A) ::= SHOW TRANSACTION ISOLATION LEVEL. { variableShowStmt *n = makeNode(variableShowStmt); n->name = "transaction_isolation"; A = (Node *) n; } variableShowStmt(A) ::= SHOW SESSION AUTHORIZATION. { variableShowStmt *n = makeNode(variableShowStmt); n->name = "session_authorization"; A = (Node *) n; } variableShowStmt(A) ::= SHOW ALL. { variableShowStmt *n = makeNode(variableShowStmt); n->name = "all"; A = (Node *) n; } /* ----- constraintsSetStmt ----- */ constraintsSetStmt(A) ::= SET CONSTRAINTS constraints_set_list(D) constraints_set_mode(E). { constraintsSetStmt *n = makeNode(constraintsSetStmt); n->constraints = D; n->deferred = E; A = (Node *) n; } /* ----- constraints_set_list ----- */ constraints_set_list(A) ::= ALL. { A = NIL; } constraints_set_list(A) ::= qualified_name_list(B). { A = B; } /* ----- constraints_set_mode ----- */ constraints_set_mode(A) ::= DEFERRED. { A = true; } constraints_set_mode(A) ::= IMMEDIATE. { A = false; } /* ----- checkPointStmt ----- */ checkPointStmt(A) ::= CHECKPOINT opt_utility_option_list(C). { checkPointStmt *n = makeNode(checkPointStmt); A = (Node *) n; n->options = C; } /* ----- discardStmt ----- */ discardStmt(A) ::= DISCARD ALL. { discardStmt *n = makeNode(discardStmt); n->target = DISCARD_ALL; A = (Node *) n; } discardStmt(A) ::= DISCARD TEMP. { discardStmt *n = makeNode(discardStmt); n->target = DISCARD_TEMP; A = (Node *) n; } discardStmt(A) ::= DISCARD TEMPORARY. { discardStmt *n = makeNode(discardStmt); n->target = DISCARD_TEMP; A = (Node *) n; } discardStmt(A) ::= DISCARD PLANS. { discardStmt *n = makeNode(discardStmt); n->target = DISCARD_PLANS; A = (Node *) n; } discardStmt(A) ::= DISCARD SEQUENCES. { discardStmt *n = makeNode(discardStmt); n->target = DISCARD_SEQUENCES; A = (Node *) n; } /* ----- alterTableStmt ----- */ alterTableStmt(A) ::= ALTER TABLE relation_expr(D) alter_table_cmds(E). { alterTableStmt *n = makeNode(alterTableStmt); n->relation = D; n->cmds = E; n->objtype = OBJECT_TABLE; n->missing_ok = false; A = (Node *) n; } alterTableStmt(A) ::= ALTER TABLE IF_P EXISTS relation_expr(F) alter_table_cmds(G). { alterTableStmt *n = makeNode(alterTableStmt); n->relation = F; n->cmds = G; n->objtype = OBJECT_TABLE; n->missing_ok = true; A = (Node *) n; } alterTableStmt(A) ::= ALTER TABLE relation_expr(D) partition_cmd(E). { alterTableStmt *n = makeNode(alterTableStmt); n->relation = D; n->cmds = list_make1(E); n->objtype = OBJECT_TABLE; n->missing_ok = false; A = (Node *) n; } alterTableStmt(A) ::= ALTER TABLE IF_P EXISTS relation_expr(F) partition_cmd(G). { alterTableStmt *n = makeNode(alterTableStmt); n->relation = F; n->cmds = list_make1(G); n->objtype = OBJECT_TABLE; n->missing_ok = true; A = (Node *) n; } alterTableStmt(A) ::= ALTER TABLE ALL IN_P TABLESPACE name(G) SET TABLESPACE name(J) opt_nowait(K). { AlterTableMoveAllStmt *n = makeNode(AlterTableMoveAllStmt); n->orig_tablespacename = G; n->objtype = OBJECT_TABLE; n->roles = NIL; n->new_tablespacename = J; n->nowait = K; A = (Node *) n; } alterTableStmt(A) ::= ALTER TABLE ALL IN_P TABLESPACE name(G) OWNED BY role_list(J) SET TABLESPACE name(M) opt_nowait(N). { AlterTableMoveAllStmt *n = makeNode(AlterTableMoveAllStmt); n->orig_tablespacename = G; n->objtype = OBJECT_TABLE; n->roles = J; n->new_tablespacename = M; n->nowait = N; A = (Node *) n; } alterTableStmt(A) ::= ALTER INDEX qualified_name(D) alter_table_cmds(E). { alterTableStmt *n = makeNode(alterTableStmt); n->relation = D; n->cmds = E; n->objtype = OBJECT_INDEX; n->missing_ok = false; A = (Node *) n; } alterTableStmt(A) ::= ALTER INDEX IF_P EXISTS qualified_name(F) alter_table_cmds(G). { alterTableStmt *n = makeNode(alterTableStmt); n->relation = F; n->cmds = G; n->objtype = OBJECT_INDEX; n->missing_ok = true; A = (Node *) n; } alterTableStmt(A) ::= ALTER INDEX qualified_name(D) index_partition_cmd(E). { alterTableStmt *n = makeNode(alterTableStmt); n->relation = D; n->cmds = list_make1(E); n->objtype = OBJECT_INDEX; n->missing_ok = false; A = (Node *) n; } alterTableStmt(A) ::= ALTER INDEX ALL IN_P TABLESPACE name(G) SET TABLESPACE name(J) opt_nowait(K). { AlterTableMoveAllStmt *n = makeNode(AlterTableMoveAllStmt); n->orig_tablespacename = G; n->objtype = OBJECT_INDEX; n->roles = NIL; n->new_tablespacename = J; n->nowait = K; A = (Node *) n; } alterTableStmt(A) ::= ALTER INDEX ALL IN_P TABLESPACE name(G) OWNED BY role_list(J) SET TABLESPACE name(M) opt_nowait(N). { AlterTableMoveAllStmt *n = makeNode(AlterTableMoveAllStmt); n->orig_tablespacename = G; n->objtype = OBJECT_INDEX; n->roles = J; n->new_tablespacename = M; n->nowait = N; A = (Node *) n; } alterTableStmt(A) ::= ALTER SEQUENCE qualified_name(D) alter_table_cmds(E). { alterTableStmt *n = makeNode(alterTableStmt); n->relation = D; n->cmds = E; n->objtype = OBJECT_SEQUENCE; n->missing_ok = false; A = (Node *) n; } alterTableStmt(A) ::= ALTER SEQUENCE IF_P EXISTS qualified_name(F) alter_table_cmds(G). { alterTableStmt *n = makeNode(alterTableStmt); n->relation = F; n->cmds = G; n->objtype = OBJECT_SEQUENCE; n->missing_ok = true; A = (Node *) n; } alterTableStmt(A) ::= ALTER VIEW qualified_name(D) alter_table_cmds(E). { alterTableStmt *n = makeNode(alterTableStmt); n->relation = D; n->cmds = E; n->objtype = OBJECT_VIEW; n->missing_ok = false; A = (Node *) n; } alterTableStmt(A) ::= ALTER VIEW IF_P EXISTS qualified_name(F) alter_table_cmds(G). { alterTableStmt *n = makeNode(alterTableStmt); n->relation = F; n->cmds = G; n->objtype = OBJECT_VIEW; n->missing_ok = true; A = (Node *) n; } alterTableStmt(A) ::= ALTER MATERIALIZED VIEW qualified_name(E) alter_table_cmds(F). { alterTableStmt *n = makeNode(alterTableStmt); n->relation = E; n->cmds = F; n->objtype = OBJECT_MATVIEW; n->missing_ok = false; A = (Node *) n; } alterTableStmt(A) ::= ALTER MATERIALIZED VIEW IF_P EXISTS qualified_name(G) alter_table_cmds(H). { alterTableStmt *n = makeNode(alterTableStmt); n->relation = G; n->cmds = H; n->objtype = OBJECT_MATVIEW; n->missing_ok = true; A = (Node *) n; } alterTableStmt(A) ::= ALTER MATERIALIZED VIEW ALL IN_P TABLESPACE name(H) SET TABLESPACE name(K) opt_nowait(L). { AlterTableMoveAllStmt *n = makeNode(AlterTableMoveAllStmt); n->orig_tablespacename = H; n->objtype = OBJECT_MATVIEW; n->roles = NIL; n->new_tablespacename = K; n->nowait = L; A = (Node *) n; } alterTableStmt(A) ::= ALTER MATERIALIZED VIEW ALL IN_P TABLESPACE name(H) OWNED BY role_list(K) SET TABLESPACE name(N) opt_nowait(O). { AlterTableMoveAllStmt *n = makeNode(AlterTableMoveAllStmt); n->orig_tablespacename = H; n->objtype = OBJECT_MATVIEW; n->roles = K; n->new_tablespacename = N; n->nowait = O; A = (Node *) n; } alterTableStmt(A) ::= ALTER FOREIGN TABLE relation_expr(E) alter_table_cmds(F). { alterTableStmt *n = makeNode(alterTableStmt); n->relation = E; n->cmds = F; n->objtype = OBJECT_FOREIGN_TABLE; n->missing_ok = false; A = (Node *) n; } alterTableStmt(A) ::= ALTER FOREIGN TABLE IF_P EXISTS relation_expr(G) alter_table_cmds(H). { alterTableStmt *n = makeNode(alterTableStmt); n->relation = G; n->cmds = H; n->objtype = OBJECT_FOREIGN_TABLE; n->missing_ok = true; A = (Node *) n; } /* ----- alter_table_cmds ----- */ alter_table_cmds(A) ::= alter_table_cmd(B). { A = list_make1(B); } alter_table_cmds(A) ::= alter_table_cmds(B) COMMA alter_table_cmd(D). { A = lappend(B, D); } /* ----- partitions_list ----- */ partitions_list(A) ::= singlePartitionSpec(B). { A = list_make1(B); } partitions_list(A) ::= partitions_list(B) COMMA singlePartitionSpec(D). { A = lappend(B, D); } /* ----- singlePartitionSpec ----- */ singlePartitionSpec(A) ::= PARTITION qualified_name(C) partitionBoundSpec(D). { singlePartitionSpec *n = makeNode(singlePartitionSpec); n->name = C; n->bound = D; A = n; } /* ----- partition_cmd ----- */ partition_cmd(A) ::= ATTACH PARTITION qualified_name(D) partitionBoundSpec(E). { AlterTableCmd *n = makeNode(AlterTableCmd); PartitionCmd *cmd = makeNode(PartitionCmd); n->subtype = AT_AttachPartition; cmd->name = D; cmd->bound = E; cmd->partlist = NIL; cmd->concurrent = false; n->def = (Node *) cmd; A = (Node *) n; } partition_cmd(A) ::= DETACH PARTITION qualified_name(D) opt_concurrently(E). { AlterTableCmd *n = makeNode(AlterTableCmd); PartitionCmd *cmd = makeNode(PartitionCmd); n->subtype = AT_DetachPartition; cmd->name = D; cmd->bound = NULL; cmd->partlist = NIL; cmd->concurrent = E; n->def = (Node *) cmd; A = (Node *) n; } partition_cmd(A) ::= DETACH PARTITION qualified_name(D) FINALIZE. { AlterTableCmd *n = makeNode(AlterTableCmd); PartitionCmd *cmd = makeNode(PartitionCmd); n->subtype = AT_DetachPartitionFinalize; cmd->name = D; cmd->bound = NULL; cmd->partlist = NIL; cmd->concurrent = false; n->def = (Node *) cmd; A = (Node *) n; } partition_cmd(A) ::= SPLIT PARTITION qualified_name(D) INTO LPAREN partitions_list(G) RPAREN. { AlterTableCmd *n = makeNode(AlterTableCmd); PartitionCmd *cmd = makeNode(PartitionCmd); n->subtype = AT_SplitPartition; cmd->name = D; cmd->bound = NULL; cmd->partlist = G; cmd->concurrent = false; n->def = (Node *) cmd; A = (Node *) n; } partition_cmd(A) ::= MERGE PARTITIONS LPAREN qualified_name_list(E) RPAREN INTO qualified_name(H). { AlterTableCmd *n = makeNode(AlterTableCmd); PartitionCmd *cmd = makeNode(PartitionCmd); n->subtype = AT_MergePartitions; cmd->name = H; cmd->bound = NULL; cmd->partlist = E; cmd->concurrent = false; n->def = (Node *) cmd; A = (Node *) n; } /* ----- index_partition_cmd ----- */ index_partition_cmd(A) ::= ATTACH PARTITION qualified_name(D). { AlterTableCmd *n = makeNode(AlterTableCmd); PartitionCmd *cmd = makeNode(PartitionCmd); n->subtype = AT_AttachPartition; cmd->name = D; cmd->bound = NULL; cmd->partlist = NIL; cmd->concurrent = false; n->def = (Node *) cmd; A = (Node *) n; } /* ----- alter_table_cmd ----- */ alter_table_cmd(A) ::= ADD_P columnDef(C). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_AddColumn; n->def = C; n->missing_ok = false; A = (Node *) n; } alter_table_cmd(A) ::= ADD_P IF_P NOT EXISTS columnDef(F). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_AddColumn; n->def = F; n->missing_ok = true; A = (Node *) n; } alter_table_cmd(A) ::= ADD_P COLUMN columnDef(D). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_AddColumn; n->def = D; n->missing_ok = false; A = (Node *) n; } alter_table_cmd(A) ::= ADD_P COLUMN IF_P NOT EXISTS columnDef(G). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_AddColumn; n->def = G; n->missing_ok = true; A = (Node *) n; } alter_table_cmd(A) ::= ALTER opt_column(C) colId(D) alter_column_default(E). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_ColumnDefault; n->name = D; n->def = E; A = (Node *) n; } alter_table_cmd(A) ::= ALTER opt_column(C) colId(D) DROP NOT NULL_P. { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_DropNotNull; n->name = D; A = (Node *) n; } alter_table_cmd(A) ::= ALTER opt_column(C) colId(D) SET NOT NULL_P. { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_SetNotNull; n->name = D; A = (Node *) n; } alter_table_cmd(A) ::= ALTER opt_column(C) colId(D) SET EXPRESSION AS LPAREN a_expr(I) RPAREN. { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_SetExpression; n->name = D; n->def = I; A = (Node *) n; } alter_table_cmd(A) ::= ALTER opt_column(C) colId(D) DROP EXPRESSION. { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_DropExpression; n->name = D; A = (Node *) n; } alter_table_cmd(A) ::= ALTER opt_column(C) colId(D) DROP EXPRESSION IF_P EXISTS. { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_DropExpression; n->name = D; n->missing_ok = true; A = (Node *) n; } alter_table_cmd(A) ::= ALTER opt_column(C) colId(D) SET STATISTICS set_statistics_value(G). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_SetStatistics; n->name = D; n->def = G; A = (Node *) n; } alter_table_cmd(A) ::= ALTER opt_column(C) iconst(D) SET STATISTICS set_statistics_value(G). { AlterTableCmd *n = makeNode(AlterTableCmd); if (D <= 0 || D > PG_INT16_MAX) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("column number must be in range from 1 to %d", PG_INT16_MAX), parser_errposition(LOC(D)))); n->subtype = AT_SetStatistics; n->num = (int16) D; n->def = G; A = (Node *) n; } alter_table_cmd(A) ::= ALTER opt_column(C) colId(D) SET reloptions(F). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_SetOptions; n->name = D; n->def = (Node *) F; A = (Node *) n; } alter_table_cmd(A) ::= ALTER opt_column(C) colId(D) RESET reloptions(F). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_ResetOptions; n->name = D; n->def = (Node *) F; A = (Node *) n; } alter_table_cmd(A) ::= ALTER opt_column(C) colId(D) SET column_storage(F). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_SetStorage; n->name = D; n->def = (Node *) makeString(F); A = (Node *) n; } alter_table_cmd(A) ::= ALTER opt_column(C) colId(D) SET column_compression(F). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_SetCompression; n->name = D; n->def = (Node *) makeString(F); A = (Node *) n; } alter_table_cmd(A) ::= ALTER opt_column(C) colId(D) ADD_P GENERATED generated_when(G) AS IDENTITY_P optParenthesizedSeqOptList(J). { AlterTableCmd *n = makeNode(AlterTableCmd); Constraint *c = makeNode(Constraint); c->contype = CONSTR_IDENTITY; c->generated_when = G; c->options = J; c->location = LOC(F); n->subtype = AT_AddIdentity; n->name = D; n->def = (Node *) c; A = (Node *) n; } alter_table_cmd(A) ::= ALTER opt_column(C) colId(D) alter_identity_column_option_list(E). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_SetIdentity; n->name = D; n->def = (Node *) E; A = (Node *) n; } alter_table_cmd(A) ::= ALTER opt_column(C) colId(D) DROP IDENTITY_P. { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_DropIdentity; n->name = D; n->missing_ok = false; A = (Node *) n; } alter_table_cmd(A) ::= ALTER opt_column(C) colId(D) DROP IDENTITY_P IF_P EXISTS. { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_DropIdentity; n->name = D; n->missing_ok = true; A = (Node *) n; } alter_table_cmd(A) ::= DROP opt_column(C) IF_P EXISTS colId(F) opt_drop_behavior(G). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_DropColumn; n->name = F; n->behavior = G; n->missing_ok = true; A = (Node *) n; } alter_table_cmd(A) ::= DROP opt_column(C) colId(D) opt_drop_behavior(E). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_DropColumn; n->name = D; n->behavior = E; n->missing_ok = false; A = (Node *) n; } alter_table_cmd(A) ::= ALTER opt_column(C) colId(D) opt_set_data(E) TYPE_P typename(G) opt_collate_clause(H) alter_using(I). { AlterTableCmd *n = makeNode(AlterTableCmd); ColumnDef *def = makeNode(ColumnDef); n->subtype = AT_AlterColumnType; n->name = D; n->def = (Node *) def; def->typeName = G; def->collClause = (CollateClause *) H; def->raw_default = I; def->location = LOC(D); A = (Node *) n; } alter_table_cmd(A) ::= ALTER opt_column(C) colId(D) alter_generic_options(E). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_AlterColumnGenericOptions; n->name = D; n->def = (Node *) E; A = (Node *) n; } alter_table_cmd(A) ::= ADD_P tableConstraint(C). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_AddConstraint; n->def = C; A = (Node *) n; } alter_table_cmd(A) ::= ALTER CONSTRAINT name(D) constraintAttributeSpec(E). { AlterTableCmd *n = makeNode(AlterTableCmd); ATAlterConstraint *c = makeNode(ATAlterConstraint); n->subtype = AT_AlterConstraint; n->def = (Node *) c; c->conname = D; if (E & (CAS_NOT_ENFORCED | CAS_ENFORCED)) c->alterEnforceability = true; if (E & (CAS_DEFERRABLE | CAS_NOT_DEFERRABLE | CAS_INITIALLY_DEFERRED | CAS_INITIALLY_IMMEDIATE)) c->alterDeferrability = true; if (E & CAS_NO_INHERIT) c->alterInheritability = true; if (E & CAS_NOT_VALID) ereport(ERROR, errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("constraints cannot be altered to be NOT VALID"), parser_errposition(LOC(E))); processCASbits(E, LOC(E), "FOREIGN KEY", &c->deferrable, &c->initdeferred, &c->is_enforced, NULL, &c->noinherit, yyscanner); A = (Node *) n; } alter_table_cmd(A) ::= ALTER CONSTRAINT name(D) INHERIT. { AlterTableCmd *n = makeNode(AlterTableCmd); ATAlterConstraint *c = makeNode(ATAlterConstraint); n->subtype = AT_AlterConstraint; n->def = (Node *) c; c->conname = D; c->alterInheritability = true; c->noinherit = false; A = (Node *) n; } alter_table_cmd(A) ::= VALIDATE CONSTRAINT name(D). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_ValidateConstraint; n->name = D; A = (Node *) n; } alter_table_cmd(A) ::= DROP CONSTRAINT IF_P EXISTS name(F) opt_drop_behavior(G). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_DropConstraint; n->name = F; n->behavior = G; n->missing_ok = true; A = (Node *) n; } alter_table_cmd(A) ::= DROP CONSTRAINT name(D) opt_drop_behavior(E). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_DropConstraint; n->name = D; n->behavior = E; n->missing_ok = false; A = (Node *) n; } alter_table_cmd(A) ::= SET WITHOUT OIDS. { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_DropOids; A = (Node *) n; } alter_table_cmd(A) ::= CLUSTER ON name(D). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_ClusterOn; n->name = D; A = (Node *) n; } alter_table_cmd(A) ::= SET WITHOUT CLUSTER. { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_DropCluster; n->name = NULL; A = (Node *) n; } alter_table_cmd(A) ::= SET LOGGED. { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_SetLogged; A = (Node *) n; } alter_table_cmd(A) ::= SET UNLOGGED. { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_SetUnLogged; A = (Node *) n; } alter_table_cmd(A) ::= ENABLE_P TRIGGER name(D). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_EnableTrig; n->name = D; A = (Node *) n; } alter_table_cmd(A) ::= ENABLE_P ALWAYS TRIGGER name(E). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_EnableAlwaysTrig; n->name = E; A = (Node *) n; } alter_table_cmd(A) ::= ENABLE_P REPLICA TRIGGER name(E). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_EnableReplicaTrig; n->name = E; A = (Node *) n; } alter_table_cmd(A) ::= ENABLE_P TRIGGER ALL. { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_EnableTrigAll; A = (Node *) n; } alter_table_cmd(A) ::= ENABLE_P TRIGGER USER. { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_EnableTrigUser; A = (Node *) n; } alter_table_cmd(A) ::= DISABLE_P TRIGGER name(D). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_DisableTrig; n->name = D; A = (Node *) n; } alter_table_cmd(A) ::= DISABLE_P TRIGGER ALL. { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_DisableTrigAll; A = (Node *) n; } alter_table_cmd(A) ::= DISABLE_P TRIGGER USER. { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_DisableTrigUser; A = (Node *) n; } alter_table_cmd(A) ::= ENABLE_P RULE name(D). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_EnableRule; n->name = D; A = (Node *) n; } alter_table_cmd(A) ::= ENABLE_P ALWAYS RULE name(E). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_EnableAlwaysRule; n->name = E; A = (Node *) n; } alter_table_cmd(A) ::= ENABLE_P REPLICA RULE name(E). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_EnableReplicaRule; n->name = E; A = (Node *) n; } alter_table_cmd(A) ::= DISABLE_P RULE name(D). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_DisableRule; n->name = D; A = (Node *) n; } alter_table_cmd(A) ::= INHERIT qualified_name(C). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_AddInherit; n->def = (Node *) C; A = (Node *) n; } alter_table_cmd(A) ::= NO INHERIT qualified_name(D). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_DropInherit; n->def = (Node *) D; A = (Node *) n; } alter_table_cmd(A) ::= OF any_name(C). { AlterTableCmd *n = makeNode(AlterTableCmd); TypeName *def = makeTypeNameFromNameList(C); def->location = LOC(C); n->subtype = AT_AddOf; n->def = (Node *) def; A = (Node *) n; } alter_table_cmd(A) ::= NOT OF. { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_DropOf; A = (Node *) n; } alter_table_cmd(A) ::= OWNER TO roleSpec(D). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_ChangeOwner; n->newowner = D; A = (Node *) n; } alter_table_cmd(A) ::= SET ACCESS METHOD set_access_method_name(E). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_SetAccessMethod; n->name = E; A = (Node *) n; } alter_table_cmd(A) ::= SET TABLESPACE name(D). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_SetTableSpace; n->name = D; A = (Node *) n; } alter_table_cmd(A) ::= SET reloptions(C). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_SetRelOptions; n->def = (Node *) C; A = (Node *) n; } alter_table_cmd(A) ::= RESET reloptions(C). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_ResetRelOptions; n->def = (Node *) C; A = (Node *) n; } alter_table_cmd(A) ::= REPLICA IDENTITY_P replica_identity(D). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_ReplicaIdentity; n->def = D; A = (Node *) n; } alter_table_cmd(A) ::= ENABLE_P ROW LEVEL SECURITY. { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_EnableRowSecurity; A = (Node *) n; } alter_table_cmd(A) ::= DISABLE_P ROW LEVEL SECURITY. { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_DisableRowSecurity; A = (Node *) n; } alter_table_cmd(A) ::= FORCE ROW LEVEL SECURITY. { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_ForceRowSecurity; A = (Node *) n; } alter_table_cmd(A) ::= NO FORCE ROW LEVEL SECURITY. { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_NoForceRowSecurity; A = (Node *) n; } alter_table_cmd(A) ::= alter_generic_options(B). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_GenericOptions; n->def = (Node *) B; A = (Node *) n; } /* ----- alter_column_default ----- */ alter_column_default(A) ::= SET DEFAULT a_expr(D). { A = D; } alter_column_default(A) ::= DROP DEFAULT. { A = NULL; } /* ----- opt_collate_clause ----- */ opt_collate_clause(A) ::= COLLATE any_name(C). { CollateClause *n = makeNode(CollateClause); n->arg = NULL; n->collname = C; n->location = LOC(B); A = (Node *) n; } opt_collate_clause(A) ::= . { A = NULL; } /* ----- alter_using ----- */ alter_using(A) ::= USING a_expr(C). { A = C; } alter_using(A) ::= . { A = NULL; } /* ----- replica_identity ----- */ replica_identity(A) ::= NOTHING. { ReplicaIdentityStmt *n = makeNode(ReplicaIdentityStmt); n->identity_type = REPLICA_IDENTITY_NOTHING; n->name = NULL; A = (Node *) n; } replica_identity(A) ::= FULL. { ReplicaIdentityStmt *n = makeNode(ReplicaIdentityStmt); n->identity_type = REPLICA_IDENTITY_FULL; n->name = NULL; A = (Node *) n; } replica_identity(A) ::= DEFAULT. { ReplicaIdentityStmt *n = makeNode(ReplicaIdentityStmt); n->identity_type = REPLICA_IDENTITY_DEFAULT; n->name = NULL; A = (Node *) n; } replica_identity(A) ::= USING INDEX name(D). { ReplicaIdentityStmt *n = makeNode(ReplicaIdentityStmt); n->identity_type = REPLICA_IDENTITY_INDEX; n->name = D; A = (Node *) n; } /* ----- reloptions ----- */ reloptions(A) ::= LPAREN reloption_list(C) RPAREN. { A = C; } /* ----- opt_reloptions ----- */ opt_reloptions(A) ::= WITH reloptions(C). { A = C; } opt_reloptions(A) ::= . { A = NIL; } /* ----- reloption_list ----- */ reloption_list(A) ::= reloption_elem(B). { A = list_make1(B); } reloption_list(A) ::= reloption_list(B) COMMA reloption_elem(D). { A = lappend(B, D); } /* ----- reloption_elem ----- */ reloption_elem(A) ::= colLabel(B) EQ def_arg(D). { A = makeDefElem(B, (Node *) D, LOC(B)); } reloption_elem(A) ::= colLabel(B). { A = makeDefElem(B, NULL, LOC(B)); } reloption_elem(A) ::= colLabel(B) DOT colLabel(D) EQ def_arg(F). { A = makeDefElemExtended(B, D, (Node *) F, DEFELEM_UNSPEC, LOC(B)); } reloption_elem(A) ::= colLabel(B) DOT colLabel(D). { A = makeDefElemExtended(B, D, NULL, DEFELEM_UNSPEC, LOC(B)); } /* ----- alter_identity_column_option_list ----- */ alter_identity_column_option_list(A) ::= alter_identity_column_option(B). { A = list_make1(B); } alter_identity_column_option_list(A) ::= alter_identity_column_option_list(B) alter_identity_column_option(C). { A = lappend(B, C); } /* ----- alter_identity_column_option ----- */ alter_identity_column_option(A) ::= RESTART. { A = makeDefElem("restart", NULL, LOC(B)); } alter_identity_column_option(A) ::= RESTART opt_with(C) numericOnly(D). { A = makeDefElem("restart", (Node *) D, LOC(B)); } alter_identity_column_option(A) ::= SET seqOptElem(C). { if (strcmp(C->defname, "as") == 0 || strcmp(C->defname, "restart") == 0 || strcmp(C->defname, "owned_by") == 0) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("sequence option \"%s\" not supported here", C->defname), parser_errposition(LOC(C)))); A = C; } alter_identity_column_option(A) ::= SET GENERATED generated_when(D). { A = makeDefElem("generated", (Node *) makeInteger(D), LOC(B)); } /* ----- set_statistics_value ----- */ set_statistics_value(A) ::= signedIconst(B). { A = (Node *) makeInteger(B); } set_statistics_value(A) ::= DEFAULT. { A = NULL; } /* ----- set_access_method_name ----- */ set_access_method_name(A) ::= colId(B). { A = B; } set_access_method_name(A) ::= DEFAULT. { A = NULL; } /* ----- partitionBoundSpec ----- */ partitionBoundSpec(A) ::= FOR VALUES WITH LPAREN hash_partbound(F) RPAREN. { ListCell *lc; partitionBoundSpec *n = makeNode(partitionBoundSpec); n->strategy = PARTITION_STRATEGY_HASH; n->modulus = n->remainder = -1; foreach (lc, F) { DefElem *opt = lfirst_node(DefElem, lc); if (strcmp(opt->defname, "modulus") == 0) { if (n->modulus != -1) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_OBJECT), errmsg("modulus for hash partition provided more than once"), parser_errposition(opt->location))); n->modulus = defGetInt32(opt); } else if (strcmp(opt->defname, "remainder") == 0) { if (n->remainder != -1) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_OBJECT), errmsg("remainder for hash partition provided more than once"), parser_errposition(opt->location))); n->remainder = defGetInt32(opt); } else ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("unrecognized hash partition bound specification \"%s\"", opt->defname), parser_errposition(opt->location))); } if (n->modulus == -1) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("modulus for hash partition must be specified"), parser_errposition(LOC(D)))); if (n->remainder == -1) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("remainder for hash partition must be specified"), parser_errposition(LOC(D)))); n->location = LOC(D); A = n; } partitionBoundSpec(A) ::= FOR VALUES IN_P LPAREN expr_list(F) RPAREN. { partitionBoundSpec *n = makeNode(partitionBoundSpec); n->strategy = PARTITION_STRATEGY_LIST; n->is_default = false; n->listdatums = F; n->location = LOC(D); A = n; } partitionBoundSpec(A) ::= FOR VALUES FROM LPAREN expr_list(F) RPAREN TO LPAREN expr_list(J) RPAREN. { partitionBoundSpec *n = makeNode(partitionBoundSpec); n->strategy = PARTITION_STRATEGY_RANGE; n->is_default = false; n->lowerdatums = F; n->upperdatums = J; n->location = LOC(D); A = n; } partitionBoundSpec(A) ::= DEFAULT. { partitionBoundSpec *n = makeNode(partitionBoundSpec); n->is_default = true; n->location = LOC(B); A = n; } /* ----- hash_partbound_elem ----- */ hash_partbound_elem(A) ::= nonReservedWord(B) iconst(C). { A = makeDefElem(B, (Node *) makeInteger(C), LOC(B)); } /* ----- hash_partbound ----- */ hash_partbound(A) ::= hash_partbound_elem(B). { A = list_make1(B); } hash_partbound(A) ::= hash_partbound(B) COMMA hash_partbound_elem(D). { A = lappend(B, D); } /* ----- alterCompositeTypeStmt ----- */ alterCompositeTypeStmt(A) ::= ALTER TYPE_P any_name(D) alter_type_cmds(E). { alterTableStmt *n = makeNode(alterTableStmt); n->relation = makeRangeVarFromAnyName(D, LOC(D), yyscanner); n->cmds = E; n->objtype = OBJECT_TYPE; A = (Node *) n; } /* ----- alter_type_cmds ----- */ alter_type_cmds(A) ::= alter_type_cmd(B). { A = list_make1(B); } alter_type_cmds(A) ::= alter_type_cmds(B) COMMA alter_type_cmd(D). { A = lappend(B, D); } /* ----- alter_type_cmd ----- */ alter_type_cmd(A) ::= ADD_P ATTRIBUTE tableFuncElement(D) opt_drop_behavior(E). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_AddColumn; n->def = D; n->behavior = E; A = (Node *) n; } alter_type_cmd(A) ::= DROP ATTRIBUTE IF_P EXISTS colId(F) opt_drop_behavior(G). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_DropColumn; n->name = F; n->behavior = G; n->missing_ok = true; A = (Node *) n; } alter_type_cmd(A) ::= DROP ATTRIBUTE colId(D) opt_drop_behavior(E). { AlterTableCmd *n = makeNode(AlterTableCmd); n->subtype = AT_DropColumn; n->name = D; n->behavior = E; n->missing_ok = false; A = (Node *) n; } alter_type_cmd(A) ::= ALTER ATTRIBUTE colId(D) opt_set_data(E) TYPE_P typename(G) opt_collate_clause(H) opt_drop_behavior(I). { AlterTableCmd *n = makeNode(AlterTableCmd); ColumnDef *def = makeNode(ColumnDef); n->subtype = AT_AlterColumnType; n->name = D; n->def = (Node *) def; n->behavior = I; def->typeName = G; def->collClause = (CollateClause *) H; def->raw_default = NULL; def->location = LOC(D); A = (Node *) n; } /* ----- closePortalStmt ----- */ closePortalStmt(A) ::= CLOSE cursor_name(C). { closePortalStmt *n = makeNode(closePortalStmt); n->portalname = C; A = (Node *) n; } closePortalStmt(A) ::= CLOSE ALL. { closePortalStmt *n = makeNode(closePortalStmt); n->portalname = NULL; A = (Node *) n; } /* ----- copyStmt ----- */ copyStmt(A) ::= COPY opt_binary(C) qualified_name(D) opt_column_list(E) copy_from(F) opt_program(G) copy_file_name(H) copy_delimiter(I) opt_with(J) copy_options(K) where_clause(L). { copyStmt *n = makeNode(copyStmt); n->relation = D; n->query = NULL; n->attlist = E; n->is_from = F; n->is_program = G; n->filename = H; n->whereClause = L; if (n->is_program && n->filename == NULL) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("STDIN/STDOUT not allowed with PROGRAM"), parser_errposition(LOC(I)))); if (!n->is_from && n->whereClause != NULL) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("WHERE clause not allowed with COPY TO"), errhint("Try the COPY (SELECT ... WHERE ...) TO variant."), parser_errposition(LOC(L)))); n->options = NIL; if (C) n->options = lappend(n->options, C); if (I) n->options = lappend(n->options, I); if (K) n->options = list_concat(n->options, K); A = (Node *) n; } copyStmt(A) ::= COPY LPAREN preparableStmt(D) RPAREN TO opt_program(G) copy_file_name(H) opt_with(I) copy_options(J). { copyStmt *n = makeNode(copyStmt); n->relation = NULL; n->query = D; n->attlist = NIL; n->is_from = false; n->is_program = G; n->filename = H; n->options = J; if (n->is_program && n->filename == NULL) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("STDIN/STDOUT not allowed with PROGRAM"), parser_errposition(LOC(F)))); A = (Node *) n; } /* ----- copy_from ----- */ copy_from(A) ::= FROM. { A = true; } copy_from(A) ::= TO. { A = false; } /* ----- opt_program ----- */ opt_program(A) ::= PROGRAM. { A = true; } opt_program(A) ::= . { A = false; } /* ----- copy_file_name ----- */ copy_file_name(A) ::= sconst(B). { A = B; } copy_file_name(A) ::= STDIN. { A = NULL; } copy_file_name(A) ::= STDOUT. { A = NULL; } /* ----- copy_options ----- */ copy_options(A) ::= copy_opt_list(B). { A = B; } copy_options(A) ::= LPAREN copy_generic_opt_list(C) RPAREN. { A = C; } /* ----- copy_opt_list ----- */ copy_opt_list(A) ::= copy_opt_list(B) copy_opt_item(C). { A = lappend(B, C); } copy_opt_list(A) ::= . { A = NIL; } /* ----- copy_opt_item ----- */ copy_opt_item(A) ::= BINARY. { A = makeDefElem("format", (Node *) makeString("binary"), LOC(B)); } copy_opt_item(A) ::= FREEZE. { A = makeDefElem("freeze", (Node *) makeBoolean(true), LOC(B)); } copy_opt_item(A) ::= DELIMITER opt_as(C) sconst(D). { A = makeDefElem("delimiter", (Node *) makeString(D), LOC(B)); } copy_opt_item(A) ::= NULL_P opt_as(C) sconst(D). { A = makeDefElem("null", (Node *) makeString(D), LOC(B)); } copy_opt_item(A) ::= CSV. { A = makeDefElem("format", (Node *) makeString("csv"), LOC(B)); } copy_opt_item(A) ::= JSON. { A = makeDefElem("format", (Node *) makeString("json"), LOC(B)); } copy_opt_item(A) ::= HEADER_P. { A = makeDefElem("header", (Node *) makeBoolean(true), LOC(B)); } copy_opt_item(A) ::= QUOTE opt_as(C) sconst(D). { A = makeDefElem("quote", (Node *) makeString(D), LOC(B)); } copy_opt_item(A) ::= ESCAPE opt_as(C) sconst(D). { A = makeDefElem("escape", (Node *) makeString(D), LOC(B)); } copy_opt_item(A) ::= FORCE QUOTE columnList(D). { A = makeDefElem("force_quote", (Node *) D, LOC(B)); } copy_opt_item(A) ::= FORCE QUOTE STAR. { A = makeDefElem("force_quote", (Node *) makeNode(A_Star), LOC(B)); } copy_opt_item(A) ::= FORCE NOT NULL_P columnList(E). { A = makeDefElem("force_not_null", (Node *) E, LOC(B)); } copy_opt_item(A) ::= FORCE NOT NULL_P STAR. { A = makeDefElem("force_not_null", (Node *) makeNode(A_Star), LOC(B)); } copy_opt_item(A) ::= FORCE NULL_P columnList(D). { A = makeDefElem("force_null", (Node *) D, LOC(B)); } copy_opt_item(A) ::= FORCE NULL_P STAR. { A = makeDefElem("force_null", (Node *) makeNode(A_Star), LOC(B)); } copy_opt_item(A) ::= ENCODING sconst(C). { A = makeDefElem("encoding", (Node *) makeString(C), LOC(B)); } /* ----- opt_binary ----- */ opt_binary(A) ::= BINARY. { A = makeDefElem("format", (Node *) makeString("binary"), LOC(B)); } opt_binary(A) ::= . { A = NULL; } /* ----- copy_delimiter ----- */ copy_delimiter(A) ::= opt_using(B) DELIMITERS sconst(D). { A = makeDefElem("delimiter", (Node *) makeString(D), LOC(C)); } copy_delimiter(A) ::= . { A = NULL; } /* ----- opt_using ----- */ opt_using(A) ::= USING. /* ----- copy_generic_opt_list ----- */ copy_generic_opt_list(A) ::= copy_generic_opt_elem(B). { A = list_make1(B); } copy_generic_opt_list(A) ::= copy_generic_opt_list(B) COMMA copy_generic_opt_elem(D). { A = lappend(B, D); } /* ----- copy_generic_opt_elem ----- */ copy_generic_opt_elem(A) ::= colLabel(B) copy_generic_opt_arg(C). { A = makeDefElem(B, C, LOC(B)); } copy_generic_opt_elem(A) ::= FORMAT_LA copy_generic_opt_arg(C). { A = makeDefElem("format", C, LOC(B)); } /* ----- copy_generic_opt_arg ----- */ copy_generic_opt_arg(A) ::= opt_boolean_or_string(B). { A = (Node *) makeString(B); } copy_generic_opt_arg(A) ::= numericOnly(B). { A = (Node *) B; } copy_generic_opt_arg(A) ::= STAR. { A = (Node *) makeNode(A_Star); } copy_generic_opt_arg(A) ::= DEFAULT. { A = (Node *) makeString("default"); } copy_generic_opt_arg(A) ::= LPAREN copy_generic_opt_arg_list(C) RPAREN. { A = (Node *) C; } copy_generic_opt_arg(A) ::= . { A = NULL; } /* ----- copy_generic_opt_arg_list ----- */ copy_generic_opt_arg_list(A) ::= copy_generic_opt_arg_list_item(B). { A = list_make1(B); } copy_generic_opt_arg_list(A) ::= copy_generic_opt_arg_list(B) COMMA copy_generic_opt_arg_list_item(D). { A = lappend(B, D); } /* ----- copy_generic_opt_arg_list_item ----- */ copy_generic_opt_arg_list_item(A) ::= opt_boolean_or_string(B). { A = (Node *) makeString(B); } /* ----- createStmt ----- */ createStmt(A) ::= CREATE optTemp(C) TABLE qualified_name(E) LPAREN optTableElementList(G) RPAREN optInherit(I) optPartitionSpec(J) table_access_method_clause(K) optWith(L) onCommitOption(M) optTableSpace(N). { createStmt *n = makeNode(createStmt); E->relpersistence = C; n->relation = E; n->tableElts = G; n->inhRelations = I; n->partspec = J; n->ofTypename = NULL; n->constraints = NIL; n->accessMethod = K; n->options = L; n->oncommit = M; n->tablespacename = N; n->if_not_exists = false; A = (Node *) n; } createStmt(A) ::= CREATE optTemp(C) TABLE IF_P NOT EXISTS qualified_name(H) LPAREN optTableElementList(J) RPAREN optInherit(L) optPartitionSpec(M) table_access_method_clause(N) optWith(O) onCommitOption(P) optTableSpace(Q). { createStmt *n = makeNode(createStmt); H->relpersistence = C; n->relation = H; n->tableElts = J; n->inhRelations = L; n->partspec = M; n->ofTypename = NULL; n->constraints = NIL; n->accessMethod = N; n->options = O; n->oncommit = P; n->tablespacename = Q; n->if_not_exists = true; A = (Node *) n; } createStmt(A) ::= CREATE optTemp(C) TABLE qualified_name(E) OF any_name(G) optTypedTableElementList(H) optPartitionSpec(I) table_access_method_clause(J) optWith(K) onCommitOption(L) optTableSpace(M). { createStmt *n = makeNode(createStmt); E->relpersistence = C; n->relation = E; n->tableElts = H; n->inhRelations = NIL; n->partspec = I; n->ofTypename = makeTypeNameFromNameList(G); n->ofTypename->location = LOC(G); n->constraints = NIL; n->accessMethod = J; n->options = K; n->oncommit = L; n->tablespacename = M; n->if_not_exists = false; A = (Node *) n; } createStmt(A) ::= CREATE optTemp(C) TABLE IF_P NOT EXISTS qualified_name(H) OF any_name(J) optTypedTableElementList(K) optPartitionSpec(L) table_access_method_clause(M) optWith(N) onCommitOption(O) optTableSpace(P). { createStmt *n = makeNode(createStmt); H->relpersistence = C; n->relation = H; n->tableElts = K; n->inhRelations = NIL; n->partspec = L; n->ofTypename = makeTypeNameFromNameList(J); n->ofTypename->location = LOC(J); n->constraints = NIL; n->accessMethod = M; n->options = N; n->oncommit = O; n->tablespacename = P; n->if_not_exists = true; A = (Node *) n; } createStmt(A) ::= CREATE optTemp(C) TABLE qualified_name(E) PARTITION OF qualified_name(H) optTypedTableElementList(I) partitionBoundSpec(J) optPartitionSpec(K) table_access_method_clause(L) optWith(M) onCommitOption(N) optTableSpace(O). { createStmt *n = makeNode(createStmt); E->relpersistence = C; n->relation = E; n->tableElts = I; n->inhRelations = list_make1(H); n->partbound = J; n->partspec = K; n->ofTypename = NULL; n->constraints = NIL; n->accessMethod = L; n->options = M; n->oncommit = N; n->tablespacename = O; n->if_not_exists = false; A = (Node *) n; } createStmt(A) ::= CREATE optTemp(C) TABLE IF_P NOT EXISTS qualified_name(H) PARTITION OF qualified_name(K) optTypedTableElementList(L) partitionBoundSpec(M) optPartitionSpec(N) table_access_method_clause(O) optWith(P) onCommitOption(Q) optTableSpace(R). { createStmt *n = makeNode(createStmt); H->relpersistence = C; n->relation = H; n->tableElts = L; n->inhRelations = list_make1(K); n->partbound = M; n->partspec = N; n->ofTypename = NULL; n->constraints = NIL; n->accessMethod = O; n->options = P; n->oncommit = Q; n->tablespacename = R; n->if_not_exists = true; A = (Node *) n; } /* ----- optTemp ----- */ optTemp(A) ::= TEMPORARY. { A = RELPERSISTENCE_TEMP; } optTemp(A) ::= TEMP. { A = RELPERSISTENCE_TEMP; } optTemp(A) ::= LOCAL TEMPORARY. { A = RELPERSISTENCE_TEMP; } optTemp(A) ::= LOCAL TEMP. { A = RELPERSISTENCE_TEMP; } optTemp(A) ::= GLOBAL TEMPORARY. { ereport(WARNING, (errmsg("GLOBAL is deprecated in temporary table creation"), parser_errposition(LOC(B)))); A = RELPERSISTENCE_TEMP; } optTemp(A) ::= GLOBAL TEMP. { ereport(WARNING, (errmsg("GLOBAL is deprecated in temporary table creation"), parser_errposition(LOC(B)))); A = RELPERSISTENCE_TEMP; } optTemp(A) ::= UNLOGGED. { A = RELPERSISTENCE_UNLOGGED; } optTemp(A) ::= . { A = RELPERSISTENCE_PERMANENT; } /* ----- optTableElementList ----- */ optTableElementList(A) ::= tableElementList(B). { A = B; } optTableElementList(A) ::= . { A = NIL; } /* ----- optTypedTableElementList ----- */ optTypedTableElementList(A) ::= LPAREN typedTableElementList(C) RPAREN. { A = C; } optTypedTableElementList(A) ::= . { A = NIL; } /* ----- tableElementList ----- */ tableElementList(A) ::= tableElement(B). { A = list_make1(B); } tableElementList(A) ::= tableElementList(B) COMMA tableElement(D). { A = lappend(B, D); } /* ----- typedTableElementList ----- */ typedTableElementList(A) ::= typedTableElement(B). { A = list_make1(B); } typedTableElementList(A) ::= typedTableElementList(B) COMMA typedTableElement(D). { A = lappend(B, D); } /* ----- tableElement ----- */ tableElement(A) ::= columnDef(B). { A = B; } tableElement(A) ::= tableLikeClause(B). { A = B; } tableElement(A) ::= tableConstraint(B). { A = B; } /* ----- typedTableElement ----- */ typedTableElement(A) ::= columnOptions(B). { A = B; } typedTableElement(A) ::= tableConstraint(B). { A = B; } /* ----- columnDef ----- */ columnDef(A) ::= colId(B) typename(C) opt_column_storage(D) opt_column_compression(E) create_generic_options(F) colQualList(G). { ColumnDef *n = makeNode(ColumnDef); n->colname = B; n->typeName = C; n->storage_name = D; n->compression = E; n->inhcount = 0; n->is_local = true; n->is_not_null = false; n->is_from_type = false; n->storage = 0; n->raw_default = NULL; n->cooked_default = NULL; n->collOid = InvalidOid; n->fdwoptions = F; SplitColQualList(G, &n->constraints, &n->collClause, yyscanner); n->location = LOC(B); A = (Node *) n; } /* ----- columnOptions ----- */ columnOptions(A) ::= colId(B) colQualList(C). { ColumnDef *n = makeNode(ColumnDef); n->colname = B; n->typeName = NULL; n->inhcount = 0; n->is_local = true; n->is_not_null = false; n->is_from_type = false; n->storage = 0; n->raw_default = NULL; n->cooked_default = NULL; n->collOid = InvalidOid; SplitColQualList(C, &n->constraints, &n->collClause, yyscanner); n->location = LOC(B); A = (Node *) n; } columnOptions(A) ::= colId(B) WITH OPTIONS colQualList(E). { ColumnDef *n = makeNode(ColumnDef); n->colname = B; n->typeName = NULL; n->inhcount = 0; n->is_local = true; n->is_not_null = false; n->is_from_type = false; n->storage = 0; n->raw_default = NULL; n->cooked_default = NULL; n->collOid = InvalidOid; SplitColQualList(E, &n->constraints, &n->collClause, yyscanner); n->location = LOC(B); A = (Node *) n; } /* ----- column_compression ----- */ column_compression(A) ::= COMPRESSION colId(C). { A = C; } column_compression(A) ::= COMPRESSION DEFAULT. { A = pstrdup("default"); } /* ----- opt_column_compression ----- */ opt_column_compression(A) ::= column_compression(B). { A = B; } opt_column_compression(A) ::= . { A = NULL; } /* ----- column_storage ----- */ column_storage(A) ::= STORAGE colId(C). { A = C; } column_storage(A) ::= STORAGE DEFAULT. { A = pstrdup("default"); } /* ----- opt_column_storage ----- */ opt_column_storage(A) ::= column_storage(B). { A = B; } opt_column_storage(A) ::= . { A = NULL; } /* ----- colQualList ----- */ colQualList(A) ::= colQualList(B) colConstraint(C). { A = lappend(B, C); } colQualList(A) ::= . { A = NIL; } /* ----- colConstraint ----- */ colConstraint(A) ::= CONSTRAINT name(C) colConstraintElem(D). { Constraint *n = castNode(Constraint, D); n->conname = C; n->location = LOC(B); A = (Node *) n; } colConstraint(A) ::= colConstraintElem(B). { A = B; } colConstraint(A) ::= constraintAttr(B). { A = B; } colConstraint(A) ::= COLLATE any_name(C). { CollateClause *n = makeNode(CollateClause); n->arg = NULL; n->collname = C; n->location = LOC(B); A = (Node *) n; } /* ----- colConstraintElem ----- */ colConstraintElem(A) ::= NOT NULL_P opt_no_inherit(D). { Constraint *n = makeNode(Constraint); n->contype = CONSTR_NOTNULL; n->location = LOC(B); n->is_no_inherit = D; n->is_enforced = true; n->skip_validation = false; n->initially_valid = true; A = (Node *) n; } colConstraintElem(A) ::= NULL_P. { Constraint *n = makeNode(Constraint); n->contype = CONSTR_NULL; n->location = LOC(B); A = (Node *) n; } colConstraintElem(A) ::= UNIQUE opt_unique_null_treatment(C) opt_definition(D) optConsTableSpace(E). { Constraint *n = makeNode(Constraint); n->contype = CONSTR_UNIQUE; n->location = LOC(B); n->nulls_not_distinct = !C; n->keys = NULL; n->options = D; n->indexname = NULL; n->indexspace = E; A = (Node *) n; } colConstraintElem(A) ::= PRIMARY KEY opt_definition(D) optConsTableSpace(E). { Constraint *n = makeNode(Constraint); n->contype = CONSTR_PRIMARY; n->location = LOC(B); n->keys = NULL; n->options = D; n->indexname = NULL; n->indexspace = E; A = (Node *) n; } colConstraintElem(A) ::= CHECK LPAREN a_expr(D) RPAREN opt_no_inherit(F). { Constraint *n = makeNode(Constraint); n->contype = CONSTR_CHECK; n->location = LOC(B); n->is_no_inherit = F; n->raw_expr = D; n->cooked_expr = NULL; n->is_enforced = true; n->skip_validation = false; n->initially_valid = true; A = (Node *) n; } colConstraintElem(A) ::= DEFAULT b_expr(C). { Constraint *n = makeNode(Constraint); n->contype = CONSTR_DEFAULT; n->location = LOC(B); n->raw_expr = C; n->cooked_expr = NULL; A = (Node *) n; } colConstraintElem(A) ::= GENERATED generated_when(C) AS IDENTITY_P optParenthesizedSeqOptList(F). { Constraint *n = makeNode(Constraint); n->contype = CONSTR_IDENTITY; n->generated_when = C; n->options = F; n->location = LOC(B); A = (Node *) n; } colConstraintElem(A) ::= GENERATED generated_when(C) AS LPAREN a_expr(F) RPAREN opt_virtual_or_stored(H). { Constraint *n = makeNode(Constraint); n->contype = CONSTR_GENERATED; n->generated_when = C; n->raw_expr = F; n->cooked_expr = NULL; n->generated_kind = H; n->location = LOC(B); if (C != ATTRIBUTE_IDENTITY_ALWAYS) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("for a generated column, GENERATED ALWAYS must be specified"), parser_errposition(LOC(C)))); A = (Node *) n; } colConstraintElem(A) ::= REFERENCES qualified_name(C) opt_column_list(D) key_match(E) key_actions(F). { Constraint *n = makeNode(Constraint); n->contype = CONSTR_FOREIGN; n->location = LOC(B); n->pktable = C; n->fk_attrs = NIL; n->pk_attrs = D; n->fk_matchtype = E; n->fk_upd_action = (F)->updateAction->action; n->fk_del_action = (F)->deleteAction->action; n->fk_del_set_cols = (F)->deleteAction->cols; n->is_enforced = true; n->skip_validation = false; n->initially_valid = true; A = (Node *) n; } /* ----- opt_unique_null_treatment ----- */ opt_unique_null_treatment(A) ::= NULLS_P DISTINCT. { A = true; } opt_unique_null_treatment(A) ::= NULLS_P NOT DISTINCT. { A = false; } opt_unique_null_treatment(A) ::= . { A = true; } /* ----- generated_when ----- */ generated_when(A) ::= ALWAYS. { A = ATTRIBUTE_IDENTITY_ALWAYS; } generated_when(A) ::= BY DEFAULT. { A = ATTRIBUTE_IDENTITY_BY_DEFAULT; } /* ----- opt_virtual_or_stored ----- */ opt_virtual_or_stored(A) ::= STORED. { A = ATTRIBUTE_GENERATED_STORED; } opt_virtual_or_stored(A) ::= VIRTUAL. { A = ATTRIBUTE_GENERATED_VIRTUAL; } opt_virtual_or_stored(A) ::= . { A = ATTRIBUTE_GENERATED_VIRTUAL; } /* ----- constraintAttr ----- */ constraintAttr(A) ::= DEFERRABLE. { Constraint *n = makeNode(Constraint); n->contype = CONSTR_ATTR_DEFERRABLE; n->location = LOC(B); A = (Node *) n; } constraintAttr(A) ::= NOT DEFERRABLE. { Constraint *n = makeNode(Constraint); n->contype = CONSTR_ATTR_NOT_DEFERRABLE; n->location = LOC(B); A = (Node *) n; } constraintAttr(A) ::= INITIALLY DEFERRED. { Constraint *n = makeNode(Constraint); n->contype = CONSTR_ATTR_DEFERRED; n->location = LOC(B); A = (Node *) n; } constraintAttr(A) ::= INITIALLY IMMEDIATE. { Constraint *n = makeNode(Constraint); n->contype = CONSTR_ATTR_IMMEDIATE; n->location = LOC(B); A = (Node *) n; } constraintAttr(A) ::= ENFORCED. { Constraint *n = makeNode(Constraint); n->contype = CONSTR_ATTR_ENFORCED; n->location = LOC(B); A = (Node *) n; } constraintAttr(A) ::= NOT ENFORCED. { Constraint *n = makeNode(Constraint); n->contype = CONSTR_ATTR_NOT_ENFORCED; n->location = LOC(B); A = (Node *) n; } /* ----- tableLikeClause ----- */ tableLikeClause(A) ::= LIKE qualified_name(C) tableLikeOptionList(D). { tableLikeClause *n = makeNode(tableLikeClause); n->relation = C; n->options = D; n->relationOid = InvalidOid; A = (Node *) n; } /* ----- tableLikeOptionList ----- */ tableLikeOptionList(A) ::= tableLikeOptionList(B) INCLUDING tableLikeOption(D). { A = B | D; } tableLikeOptionList(A) ::= tableLikeOptionList(B) EXCLUDING tableLikeOption(D). { A = B & ~D; } tableLikeOptionList(A) ::= . { A = 0; } /* ----- tableLikeOption ----- */ tableLikeOption(A) ::= COMMENTS. { A = CREATE_TABLE_LIKE_COMMENTS; } tableLikeOption(A) ::= COMPRESSION. { A = CREATE_TABLE_LIKE_COMPRESSION; } tableLikeOption(A) ::= CONSTRAINTS. { A = CREATE_TABLE_LIKE_CONSTRAINTS; } tableLikeOption(A) ::= DEFAULTS. { A = CREATE_TABLE_LIKE_DEFAULTS; } tableLikeOption(A) ::= IDENTITY_P. { A = CREATE_TABLE_LIKE_IDENTITY; } tableLikeOption(A) ::= GENERATED. { A = CREATE_TABLE_LIKE_GENERATED; } tableLikeOption(A) ::= INDEXES. { A = CREATE_TABLE_LIKE_INDEXES; } tableLikeOption(A) ::= STATISTICS. { A = CREATE_TABLE_LIKE_STATISTICS; } tableLikeOption(A) ::= STORAGE. { A = CREATE_TABLE_LIKE_STORAGE; } tableLikeOption(A) ::= ALL. { A = CREATE_TABLE_LIKE_ALL; } /* ----- tableConstraint ----- */ tableConstraint(A) ::= CONSTRAINT name(C) constraintElem(D). { Constraint *n = castNode(Constraint, D); n->conname = C; n->location = LOC(B); A = (Node *) n; } tableConstraint(A) ::= constraintElem(B). { A = B; } /* ----- constraintElem ----- */ constraintElem(A) ::= CHECK LPAREN a_expr(D) RPAREN constraintAttributeSpec(F). { Constraint *n = makeNode(Constraint); n->contype = CONSTR_CHECK; n->location = LOC(B); n->raw_expr = D; n->cooked_expr = NULL; processCASbits(F, LOC(F), "CHECK", NULL, NULL, &n->is_enforced, &n->skip_validation, &n->is_no_inherit, yyscanner); n->initially_valid = !n->skip_validation; A = (Node *) n; } constraintElem(A) ::= NOT NULL_P colId(D) constraintAttributeSpec(E). { Constraint *n = makeNode(Constraint); n->contype = CONSTR_NOTNULL; n->location = LOC(B); n->keys = list_make1(makeString(D)); processCASbits(E, LOC(E), "NOT NULL", NULL, NULL, NULL, &n->skip_validation, &n->is_no_inherit, yyscanner); n->initially_valid = !n->skip_validation; A = (Node *) n; } constraintElem(A) ::= UNIQUE opt_unique_null_treatment(C) LPAREN columnList(E) opt_without_overlaps(F) RPAREN opt_c_include(H) opt_definition(I) optConsTableSpace(J) constraintAttributeSpec(K). { Constraint *n = makeNode(Constraint); n->contype = CONSTR_UNIQUE; n->location = LOC(B); n->nulls_not_distinct = !C; n->keys = E; n->without_overlaps = F; n->including = H; n->options = I; n->indexname = NULL; n->indexspace = J; processCASbits(K, LOC(K), "UNIQUE", &n->deferrable, &n->initdeferred, NULL, NULL, NULL, yyscanner); A = (Node *) n; } constraintElem(A) ::= UNIQUE existingIndex(C) constraintAttributeSpec(D). { Constraint *n = makeNode(Constraint); n->contype = CONSTR_UNIQUE; n->location = LOC(B); n->keys = NIL; n->including = NIL; n->options = NIL; n->indexname = C; n->indexspace = NULL; processCASbits(D, LOC(D), "UNIQUE", &n->deferrable, &n->initdeferred, NULL, NULL, NULL, yyscanner); A = (Node *) n; } constraintElem(A) ::= PRIMARY KEY LPAREN columnList(E) opt_without_overlaps(F) RPAREN opt_c_include(H) opt_definition(I) optConsTableSpace(J) constraintAttributeSpec(K). { Constraint *n = makeNode(Constraint); n->contype = CONSTR_PRIMARY; n->location = LOC(B); n->keys = E; n->without_overlaps = F; n->including = H; n->options = I; n->indexname = NULL; n->indexspace = J; processCASbits(K, LOC(K), "PRIMARY KEY", &n->deferrable, &n->initdeferred, NULL, NULL, NULL, yyscanner); A = (Node *) n; } constraintElem(A) ::= PRIMARY KEY existingIndex(D) constraintAttributeSpec(E). { Constraint *n = makeNode(Constraint); n->contype = CONSTR_PRIMARY; n->location = LOC(B); n->keys = NIL; n->including = NIL; n->options = NIL; n->indexname = D; n->indexspace = NULL; processCASbits(E, LOC(E), "PRIMARY KEY", &n->deferrable, &n->initdeferred, NULL, NULL, NULL, yyscanner); A = (Node *) n; } constraintElem(A) ::= EXCLUDE access_method_clause(C) LPAREN exclusionConstraintList(E) RPAREN opt_c_include(G) opt_definition(H) optConsTableSpace(I) optWhereClause(J) constraintAttributeSpec(K). { Constraint *n = makeNode(Constraint); n->contype = CONSTR_EXCLUSION; n->location = LOC(B); n->access_method = C; n->exclusions = E; n->including = G; n->options = H; n->indexname = NULL; n->indexspace = I; n->where_clause = J; processCASbits(K, LOC(K), "EXCLUDE", &n->deferrable, &n->initdeferred, NULL, NULL, NULL, yyscanner); A = (Node *) n; } constraintElem(A) ::= FOREIGN KEY LPAREN columnList(E) optionalPeriodName(F) RPAREN REFERENCES qualified_name(I) opt_column_and_period_list(J) key_match(K) key_actions(L) constraintAttributeSpec(M). { Constraint *n = makeNode(Constraint); n->contype = CONSTR_FOREIGN; n->location = LOC(B); n->pktable = I; n->fk_attrs = E; if (F) { n->fk_attrs = lappend(n->fk_attrs, F); n->fk_with_period = true; } n->pk_attrs = linitial(J); if (lsecond(J)) { n->pk_attrs = lappend(n->pk_attrs, lsecond(J)); n->pk_with_period = true; } n->fk_matchtype = K; n->fk_upd_action = (L)->updateAction->action; n->fk_del_action = (L)->deleteAction->action; n->fk_del_set_cols = (L)->deleteAction->cols; processCASbits(M, LOC(M), "FOREIGN KEY", &n->deferrable, &n->initdeferred, &n->is_enforced, &n->skip_validation, NULL, yyscanner); n->initially_valid = !n->skip_validation; A = (Node *) n; } /* ----- domainConstraint ----- */ domainConstraint(A) ::= CONSTRAINT name(C) domainConstraintElem(D). { Constraint *n = castNode(Constraint, D); n->conname = C; n->location = LOC(B); A = (Node *) n; } domainConstraint(A) ::= domainConstraintElem(B). { A = B; } /* ----- domainConstraintElem ----- */ domainConstraintElem(A) ::= CHECK LPAREN a_expr(D) RPAREN constraintAttributeSpec(F). { Constraint *n = makeNode(Constraint); n->contype = CONSTR_CHECK; n->location = LOC(B); n->raw_expr = D; n->cooked_expr = NULL; processCASbits(F, LOC(F), "CHECK", NULL, NULL, NULL, &n->skip_validation, &n->is_no_inherit, yyscanner); n->is_enforced = true; n->initially_valid = !n->skip_validation; A = (Node *) n; } domainConstraintElem(A) ::= NOT NULL_P constraintAttributeSpec(D). { Constraint *n = makeNode(Constraint); n->contype = CONSTR_NOTNULL; n->location = LOC(B); n->keys = list_make1(makeString("value")); processCASbits(D, LOC(D), "NOT NULL", NULL, NULL, NULL, NULL, NULL, yyscanner); n->initially_valid = true; A = (Node *) n; } /* ----- opt_no_inherit ----- */ opt_no_inherit(A) ::= NO INHERIT. { A = true; } opt_no_inherit(A) ::= . { A = false; } /* ----- opt_without_overlaps ----- */ opt_without_overlaps(A) ::= WITHOUT OVERLAPS. { A = true; } opt_without_overlaps(A) ::= . { A = false; } /* ----- opt_column_list ----- */ opt_column_list(A) ::= LPAREN columnList(C) RPAREN. { A = C; } opt_column_list(A) ::= . { A = NIL; } /* ----- columnList ----- */ columnList(A) ::= columnElem(B). { A = list_make1(B); } columnList(A) ::= columnList(B) COMMA columnElem(D). { A = lappend(B, D); } /* ----- optionalPeriodName ----- */ optionalPeriodName(A) ::= COMMA PERIOD columnElem(D). { A = D; } optionalPeriodName(A) ::= . { A = NULL; } /* ----- opt_column_and_period_list ----- */ opt_column_and_period_list(A) ::= LPAREN columnList(C) optionalPeriodName(D) RPAREN. { A = list_make2(C, D); } opt_column_and_period_list(A) ::= . { A = list_make2(NIL, NULL); } /* ----- columnElem ----- */ columnElem(A) ::= colId(B). { A = (Node *) makeString(B); } /* ----- opt_c_include ----- */ opt_c_include(A) ::= INCLUDE LPAREN columnList(D) RPAREN. { A = D; } opt_c_include(A) ::= . { A = NIL; } /* ----- key_match ----- */ key_match(A) ::= MATCH FULL. { A = FKCONSTR_MATCH_FULL; } key_match(A) ::= MATCH PARTIAL. { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("MATCH PARTIAL not yet implemented"), parser_errposition(LOC(B)))); A = FKCONSTR_MATCH_PARTIAL; } key_match(A) ::= MATCH SIMPLE. { A = FKCONSTR_MATCH_SIMPLE; } key_match(A) ::= . { A = FKCONSTR_MATCH_SIMPLE; } /* ----- exclusionConstraintList ----- */ exclusionConstraintList(A) ::= exclusionConstraintElem(B). { A = list_make1(B); } exclusionConstraintList(A) ::= exclusionConstraintList(B) COMMA exclusionConstraintElem(D). { A = lappend(B, D); } /* ----- exclusionConstraintElem ----- */ exclusionConstraintElem(A) ::= index_elem(B) WITH any_operator(D). { A = list_make2(B, D); } exclusionConstraintElem(A) ::= index_elem(B) WITH OPERATOR LPAREN any_operator(F) RPAREN. { A = list_make2(B, F); } /* ----- optWhereClause ----- */ optWhereClause(A) ::= WHERE LPAREN a_expr(D) RPAREN. { A = D; } optWhereClause(A) ::= . { A = NULL; } /* ----- key_actions ----- */ key_actions(A) ::= key_update(B). { KeyActions *n = palloc_object(KeyActions); n->updateAction = B; n->deleteAction = palloc_object(KeyAction); n->deleteAction->action = FKCONSTR_ACTION_NOACTION; n->deleteAction->cols = NIL; A = n; } key_actions(A) ::= key_delete(B). { KeyActions *n = palloc_object(KeyActions); n->updateAction = palloc_object(KeyAction); n->updateAction->action = FKCONSTR_ACTION_NOACTION; n->updateAction->cols = NIL; n->deleteAction = B; A = n; } key_actions(A) ::= key_update(B) key_delete(C). { KeyActions *n = palloc_object(KeyActions); n->updateAction = B; n->deleteAction = C; A = n; } key_actions(A) ::= key_delete(B) key_update(C). { KeyActions *n = palloc_object(KeyActions); n->updateAction = C; n->deleteAction = B; A = n; } key_actions(A) ::= . { KeyActions *n = palloc_object(KeyActions); n->updateAction = palloc_object(KeyAction); n->updateAction->action = FKCONSTR_ACTION_NOACTION; n->updateAction->cols = NIL; n->deleteAction = palloc_object(KeyAction); n->deleteAction->action = FKCONSTR_ACTION_NOACTION; n->deleteAction->cols = NIL; A = n; } /* ----- key_update ----- */ key_update(A) ::= ON UPDATE key_action(D). { if ((D)->cols) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("a column list with %s is only supported for ON DELETE actions", (D)->action == FKCONSTR_ACTION_SETNULL ? "SET NULL" : "SET DEFAULT"), parser_errposition(LOC(B)))); A = D; } /* ----- key_delete ----- */ key_delete(A) ::= ON DELETE_P key_action(D). { A = D; } /* ----- key_action ----- */ key_action(A) ::= NO ACTION. { KeyAction *n = palloc_object(KeyAction); n->action = FKCONSTR_ACTION_NOACTION; n->cols = NIL; A = n; } key_action(A) ::= RESTRICT. { KeyAction *n = palloc_object(KeyAction); n->action = FKCONSTR_ACTION_RESTRICT; n->cols = NIL; A = n; } key_action(A) ::= CASCADE. { KeyAction *n = palloc_object(KeyAction); n->action = FKCONSTR_ACTION_CASCADE; n->cols = NIL; A = n; } key_action(A) ::= SET NULL_P opt_column_list(D). { KeyAction *n = palloc_object(KeyAction); n->action = FKCONSTR_ACTION_SETNULL; n->cols = D; A = n; } key_action(A) ::= SET DEFAULT opt_column_list(D). { KeyAction *n = palloc_object(KeyAction); n->action = FKCONSTR_ACTION_SETDEFAULT; n->cols = D; A = n; } /* ----- optInherit ----- */ optInherit(A) ::= INHERITS LPAREN qualified_name_list(D) RPAREN. { A = D; } optInherit(A) ::= . { A = NIL; } /* ----- optPartitionSpec ----- */ optPartitionSpec(A) ::= partitionSpec(B). { A = B; } optPartitionSpec(A) ::= . { A = NULL; } /* ----- partitionSpec ----- */ partitionSpec(A) ::= PARTITION BY colId(D) LPAREN part_params(F) RPAREN. { partitionSpec *n = makeNode(partitionSpec); n->strategy = parsePartitionStrategy(D, LOC(D), yyscanner); n->partParams = F; n->location = LOC(B); A = n; } /* ----- part_params ----- */ part_params(A) ::= part_elem(B). { A = list_make1(B); } part_params(A) ::= part_params(B) COMMA part_elem(D). { A = lappend(B, D); } /* ----- part_elem ----- */ part_elem(A) ::= colId(B) opt_collate(C) opt_qualified_name(D). { PartitionElem *n = makeNode(PartitionElem); n->name = B; n->expr = NULL; n->collation = C; n->opclass = D; n->location = LOC(B); A = n; } part_elem(A) ::= func_expr_windowless(B) opt_collate(C) opt_qualified_name(D). { PartitionElem *n = makeNode(PartitionElem); n->name = NULL; n->expr = B; n->collation = C; n->opclass = D; n->location = LOC(B); A = n; } part_elem(A) ::= LPAREN a_expr(C) RPAREN opt_collate(E) opt_qualified_name(F). { PartitionElem *n = makeNode(PartitionElem); n->name = NULL; n->expr = C; n->collation = E; n->opclass = F; n->location = LOC(B); A = n; } /* ----- table_access_method_clause ----- */ table_access_method_clause(A) ::= USING name(C). { A = C; } table_access_method_clause(A) ::= . { A = NULL; } /* ----- optWith ----- */ optWith(A) ::= WITH reloptions(C). { A = C; } optWith(A) ::= WITHOUT OIDS. { A = NIL; } optWith(A) ::= . { A = NIL; } /* ----- onCommitOption ----- */ onCommitOption(A) ::= ON COMMIT DROP. { A = ONCOMMIT_DROP; } onCommitOption(A) ::= ON COMMIT DELETE_P ROWS. { A = ONCOMMIT_DELETE_ROWS; } onCommitOption(A) ::= ON COMMIT PRESERVE ROWS. { A = ONCOMMIT_PRESERVE_ROWS; } onCommitOption(A) ::= . { A = ONCOMMIT_NOOP; } /* ----- optTableSpace ----- */ optTableSpace(A) ::= TABLESPACE name(C). { A = C; } optTableSpace(A) ::= . { A = NULL; } /* ----- optConsTableSpace ----- */ optConsTableSpace(A) ::= USING INDEX TABLESPACE name(E). { A = E; } optConsTableSpace(A) ::= . { A = NULL; } /* ----- existingIndex ----- */ existingIndex(A) ::= USING INDEX name(D). { A = D; } /* ----- createStatsStmt ----- */ createStatsStmt(A) ::= CREATE STATISTICS opt_qualified_name(D) opt_name_list(E) ON stats_params(G) FROM from_list(I). { createStatsStmt *n = makeNode(createStatsStmt); n->defnames = D; n->stat_types = E; n->exprs = G; n->relations = I; n->stxcomment = NULL; n->if_not_exists = false; A = (Node *) n; } createStatsStmt(A) ::= CREATE STATISTICS IF_P NOT EXISTS any_name(G) opt_name_list(H) ON stats_params(J) FROM from_list(L). { createStatsStmt *n = makeNode(createStatsStmt); n->defnames = G; n->stat_types = H; n->exprs = J; n->relations = L; n->stxcomment = NULL; n->if_not_exists = true; A = (Node *) n; } /* ----- stats_params ----- */ stats_params(A) ::= stats_param(B). { A = list_make1(B); } stats_params(A) ::= stats_params(B) COMMA stats_param(D). { A = lappend(B, D); } /* ----- stats_param ----- */ stats_param(A) ::= colId(B). { A = makeNode(StatsElem); A->name = B; A->expr = NULL; } stats_param(A) ::= func_expr_windowless(B). { A = makeNode(StatsElem); A->name = NULL; A->expr = B; } stats_param(A) ::= LPAREN a_expr(C) RPAREN. { A = makeNode(StatsElem); A->name = NULL; A->expr = C; } /* ----- alterStatsStmt ----- */ alterStatsStmt(A) ::= ALTER STATISTICS any_name(D) SET STATISTICS set_statistics_value(G). { alterStatsStmt *n = makeNode(alterStatsStmt); n->defnames = D; n->missing_ok = false; n->stxstattarget = G; A = (Node *) n; } alterStatsStmt(A) ::= ALTER STATISTICS IF_P EXISTS any_name(F) SET STATISTICS set_statistics_value(I). { alterStatsStmt *n = makeNode(alterStatsStmt); n->defnames = F; n->missing_ok = true; n->stxstattarget = I; A = (Node *) n; } /* ----- createAsStmt ----- */ createAsStmt(A) ::= CREATE optTemp(C) TABLE create_as_target(E) AS selectStmt(G) opt_with_data(H). { CreateTableAsStmt *ctas = makeNode(CreateTableAsStmt); ctas->query = G; ctas->into = E; ctas->objtype = OBJECT_TABLE; ctas->is_select_into = false; ctas->if_not_exists = false; E->rel->relpersistence = C; E->skipData = !(H); A = (Node *) ctas; } createAsStmt(A) ::= CREATE optTemp(C) TABLE IF_P NOT EXISTS create_as_target(H) AS selectStmt(J) opt_with_data(K). { CreateTableAsStmt *ctas = makeNode(CreateTableAsStmt); ctas->query = J; ctas->into = H; ctas->objtype = OBJECT_TABLE; ctas->is_select_into = false; ctas->if_not_exists = true; H->rel->relpersistence = C; H->skipData = !(K); A = (Node *) ctas; } /* ----- create_as_target ----- */ create_as_target(A) ::= qualified_name(B) opt_column_list(C) table_access_method_clause(D) optWith(E) onCommitOption(F) optTableSpace(G). { A = makeNode(IntoClause); A->rel = B; A->colNames = C; A->accessMethod = D; A->options = E; A->onCommit = F; A->tableSpaceName = G; A->viewQuery = NULL; A->skipData = false; } /* ----- opt_with_data ----- */ opt_with_data(A) ::= WITH DATA_P. { A = true; } opt_with_data(A) ::= WITH NO DATA_P. { A = false; } opt_with_data(A) ::= . { A = true; } /* ----- createMatViewStmt ----- */ createMatViewStmt(A) ::= CREATE optNoLog(C) MATERIALIZED VIEW create_mv_target(F) AS selectStmt(H) opt_with_data(I). { CreateTableAsStmt *ctas = makeNode(CreateTableAsStmt); ctas->query = H; ctas->into = F; ctas->objtype = OBJECT_MATVIEW; ctas->is_select_into = false; ctas->if_not_exists = false; F->rel->relpersistence = C; F->skipData = !(I); A = (Node *) ctas; } createMatViewStmt(A) ::= CREATE optNoLog(C) MATERIALIZED VIEW IF_P NOT EXISTS create_mv_target(I) AS selectStmt(K) opt_with_data(L). { CreateTableAsStmt *ctas = makeNode(CreateTableAsStmt); ctas->query = K; ctas->into = I; ctas->objtype = OBJECT_MATVIEW; ctas->is_select_into = false; ctas->if_not_exists = true; I->rel->relpersistence = C; I->skipData = !(L); A = (Node *) ctas; } /* ----- create_mv_target ----- */ create_mv_target(A) ::= qualified_name(B) opt_column_list(C) table_access_method_clause(D) opt_reloptions(E) optTableSpace(F). { A = makeNode(IntoClause); A->rel = B; A->colNames = C; A->accessMethod = D; A->options = E; A->onCommit = ONCOMMIT_NOOP; A->tableSpaceName = F; A->viewQuery = NULL; A->skipData = false; } /* ----- optNoLog ----- */ optNoLog(A) ::= UNLOGGED. { A = RELPERSISTENCE_UNLOGGED; } optNoLog(A) ::= . { A = RELPERSISTENCE_PERMANENT; } /* ----- refreshMatViewStmt ----- */ refreshMatViewStmt(A) ::= REFRESH MATERIALIZED VIEW opt_concurrently(E) qualified_name(F) opt_with_data(G). { refreshMatViewStmt *n = makeNode(refreshMatViewStmt); n->concurrent = E; n->relation = F; n->skipData = !(G); A = (Node *) n; } /* ----- createSeqStmt ----- */ createSeqStmt(A) ::= CREATE optTemp(C) SEQUENCE qualified_name(E) optSeqOptList(F). { createSeqStmt *n = makeNode(createSeqStmt); E->relpersistence = C; n->sequence = E; n->options = F; n->ownerId = InvalidOid; n->if_not_exists = false; A = (Node *) n; } createSeqStmt(A) ::= CREATE optTemp(C) SEQUENCE IF_P NOT EXISTS qualified_name(H) optSeqOptList(I). { createSeqStmt *n = makeNode(createSeqStmt); H->relpersistence = C; n->sequence = H; n->options = I; n->ownerId = InvalidOid; n->if_not_exists = true; A = (Node *) n; } /* ----- alterSeqStmt ----- */ alterSeqStmt(A) ::= ALTER SEQUENCE qualified_name(D) seqOptList(E). { alterSeqStmt *n = makeNode(alterSeqStmt); n->sequence = D; n->options = E; n->missing_ok = false; A = (Node *) n; } alterSeqStmt(A) ::= ALTER SEQUENCE IF_P EXISTS qualified_name(F) seqOptList(G). { alterSeqStmt *n = makeNode(alterSeqStmt); n->sequence = F; n->options = G; n->missing_ok = true; A = (Node *) n; } /* ----- optSeqOptList ----- */ optSeqOptList(A) ::= seqOptList(B). { A = B; } optSeqOptList(A) ::= . { A = NIL; } /* ----- optParenthesizedSeqOptList ----- */ optParenthesizedSeqOptList(A) ::= LPAREN seqOptList(C) RPAREN. { A = C; } optParenthesizedSeqOptList(A) ::= . { A = NIL; } /* ----- seqOptList ----- */ seqOptList(A) ::= seqOptElem(B). { A = list_make1(B); } seqOptList(A) ::= seqOptList(B) seqOptElem(C). { A = lappend(B, C); } /* ----- seqOptElem ----- */ seqOptElem(A) ::= AS simpleTypename(C). { A = makeDefElem("as", (Node *) C, LOC(B)); } seqOptElem(A) ::= CACHE numericOnly(C). { A = makeDefElem("cache", (Node *) C, LOC(B)); } seqOptElem(A) ::= CYCLE. { A = makeDefElem("cycle", (Node *) makeBoolean(true), LOC(B)); } seqOptElem(A) ::= NO CYCLE. { A = makeDefElem("cycle", (Node *) makeBoolean(false), LOC(B)); } seqOptElem(A) ::= INCREMENT opt_by(C) numericOnly(D). { A = makeDefElem("increment", (Node *) D, LOC(B)); } seqOptElem(A) ::= LOGGED. { A = makeDefElem("logged", NULL, LOC(B)); } seqOptElem(A) ::= MAXVALUE numericOnly(C). { A = makeDefElem("maxvalue", (Node *) C, LOC(B)); } seqOptElem(A) ::= MINVALUE numericOnly(C). { A = makeDefElem("minvalue", (Node *) C, LOC(B)); } seqOptElem(A) ::= NO MAXVALUE. { A = makeDefElem("maxvalue", NULL, LOC(B)); } seqOptElem(A) ::= NO MINVALUE. { A = makeDefElem("minvalue", NULL, LOC(B)); } seqOptElem(A) ::= OWNED BY any_name(D). { A = makeDefElem("owned_by", (Node *) D, LOC(B)); } seqOptElem(A) ::= SEQUENCE NAME_P any_name(D). { A = makeDefElem("sequence_name", (Node *) D, LOC(B)); } seqOptElem(A) ::= START opt_with(C) numericOnly(D). { A = makeDefElem("start", (Node *) D, LOC(B)); } seqOptElem(A) ::= RESTART. { A = makeDefElem("restart", NULL, LOC(B)); } seqOptElem(A) ::= RESTART opt_with(C) numericOnly(D). { A = makeDefElem("restart", (Node *) D, LOC(B)); } seqOptElem(A) ::= UNLOGGED. { A = makeDefElem("unlogged", NULL, LOC(B)); } /* ----- opt_by ----- */ opt_by(A) ::= BY. /* ----- numericOnly ----- */ numericOnly(A) ::= FCONST. { A = (Node *) makeFloat(B); } numericOnly(A) ::= PLUS FCONST. { A = (Node *) makeFloat(C); } numericOnly(A) ::= MINUS FCONST. { Float *f = makeFloat(C); doNegateFloat(f); A = (Node *) f; } numericOnly(A) ::= signedIconst(B). { A = (Node *) makeInteger(B); } /* ----- numericOnly_list ----- */ numericOnly_list(A) ::= numericOnly(B). { A = list_make1(B); } numericOnly_list(A) ::= numericOnly_list(B) COMMA numericOnly(D). { A = lappend(B, D); } /* ----- createPLangStmt ----- */ createPLangStmt(A) ::= CREATE opt_or_replace(C) opt_trusted(D) opt_procedural(E) LANGUAGE name(G). { createExtensionStmt *n = makeNode(createExtensionStmt); n->if_not_exists = C; n->extname = G; n->options = NIL; A = (Node *) n; } createPLangStmt(A) ::= CREATE opt_or_replace(C) opt_trusted(D) opt_procedural(E) LANGUAGE name(G) HANDLER handler_name(I) opt_inline_handler(J) opt_validator(K). { createPLangStmt *n = makeNode(createPLangStmt); n->replace = C; n->plname = G; n->plhandler = I; n->plinline = J; n->plvalidator = K; n->pltrusted = D; A = (Node *) n; } /* ----- opt_trusted ----- */ opt_trusted(A) ::= TRUSTED. { A = true; } opt_trusted(A) ::= . { A = false; } /* ----- handler_name ----- */ handler_name(A) ::= name(B). { A = list_make1(makeString(B)); } handler_name(A) ::= name(B) attrs(C). { A = lcons(makeString(B), C); } /* ----- opt_inline_handler ----- */ opt_inline_handler(A) ::= INLINE_P handler_name(C). { A = C; } opt_inline_handler(A) ::= . { A = NIL; } /* ----- validator_clause ----- */ validator_clause(A) ::= VALIDATOR handler_name(C). { A = C; } validator_clause(A) ::= NO VALIDATOR. { A = NIL; } /* ----- opt_validator ----- */ opt_validator(A) ::= validator_clause(B). { A = B; } opt_validator(A) ::= . { A = NIL; } /* ----- opt_procedural ----- */ opt_procedural(A) ::= PROCEDURAL. /* ----- createTableSpaceStmt ----- */ createTableSpaceStmt(A) ::= CREATE TABLESPACE name(D) optTableSpaceOwner(E) LOCATION sconst(G) opt_reloptions(H). { createTableSpaceStmt *n = makeNode(createTableSpaceStmt); n->tablespacename = D; n->owner = E; n->location = G; n->options = H; A = (Node *) n; } /* ----- optTableSpaceOwner ----- */ optTableSpaceOwner(A) ::= OWNER roleSpec(C). { A = C; } optTableSpaceOwner(A) ::= . { A = NULL; } /* ----- dropTableSpaceStmt ----- */ dropTableSpaceStmt(A) ::= DROP TABLESPACE name(D). { dropTableSpaceStmt *n = makeNode(dropTableSpaceStmt); n->tablespacename = D; n->missing_ok = false; A = (Node *) n; } dropTableSpaceStmt(A) ::= DROP TABLESPACE IF_P EXISTS name(F). { dropTableSpaceStmt *n = makeNode(dropTableSpaceStmt); n->tablespacename = F; n->missing_ok = true; A = (Node *) n; } /* ----- createExtensionStmt ----- */ createExtensionStmt(A) ::= CREATE EXTENSION name(D) opt_with(E) create_extension_opt_list(F). { createExtensionStmt *n = makeNode(createExtensionStmt); n->extname = D; n->if_not_exists = false; n->options = F; A = (Node *) n; } createExtensionStmt(A) ::= CREATE EXTENSION IF_P NOT EXISTS name(G) opt_with(H) create_extension_opt_list(I). { createExtensionStmt *n = makeNode(createExtensionStmt); n->extname = G; n->if_not_exists = true; n->options = I; A = (Node *) n; } /* ----- create_extension_opt_list ----- */ create_extension_opt_list(A) ::= create_extension_opt_list(B) create_extension_opt_item(C). { A = lappend(B, C); } create_extension_opt_list(A) ::= . { A = NIL; } /* ----- create_extension_opt_item ----- */ create_extension_opt_item(A) ::= SCHEMA name(C). { A = makeDefElem("schema", (Node *) makeString(C), LOC(B)); } create_extension_opt_item(A) ::= VERSION_P nonReservedWord_or_Sconst(C). { A = makeDefElem("new_version", (Node *) makeString(C), LOC(B)); } create_extension_opt_item(A) ::= FROM nonReservedWord_or_Sconst(C). { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("CREATE EXTENSION ... FROM is no longer supported"), parser_errposition(LOC(B)))); } create_extension_opt_item(A) ::= CASCADE. { A = makeDefElem("cascade", (Node *) makeBoolean(true), LOC(B)); } /* ----- alterExtensionStmt ----- */ alterExtensionStmt(A) ::= ALTER EXTENSION name(D) UPDATE alter_extension_opt_list(F). { alterExtensionStmt *n = makeNode(alterExtensionStmt); n->extname = D; n->options = F; A = (Node *) n; } /* ----- alter_extension_opt_list ----- */ alter_extension_opt_list(A) ::= alter_extension_opt_list(B) alter_extension_opt_item(C). { A = lappend(B, C); } alter_extension_opt_list(A) ::= . { A = NIL; } /* ----- alter_extension_opt_item ----- */ alter_extension_opt_item(A) ::= TO nonReservedWord_or_Sconst(C). { A = makeDefElem("new_version", (Node *) makeString(C), LOC(B)); } /* ----- alterExtensionContentsStmt ----- */ alterExtensionContentsStmt(A) ::= ALTER EXTENSION name(D) add_drop(E) object_type_name(F) name(G). { alterExtensionContentsStmt *n = makeNode(alterExtensionContentsStmt); n->extname = D; n->action = E; n->objtype = F; n->object = (Node *) makeString(G); A = (Node *) n; } alterExtensionContentsStmt(A) ::= ALTER EXTENSION name(D) add_drop(E) object_type_any_name(F) any_name(G). { alterExtensionContentsStmt *n = makeNode(alterExtensionContentsStmt); n->extname = D; n->action = E; n->objtype = F; n->object = (Node *) G; A = (Node *) n; } alterExtensionContentsStmt(A) ::= ALTER EXTENSION name(D) add_drop(E) AGGREGATE aggregate_with_argtypes(G). { alterExtensionContentsStmt *n = makeNode(alterExtensionContentsStmt); n->extname = D; n->action = E; n->objtype = OBJECT_AGGREGATE; n->object = (Node *) G; A = (Node *) n; } alterExtensionContentsStmt(A) ::= ALTER EXTENSION name(D) add_drop(E) CAST LPAREN typename(H) AS typename(J) RPAREN. { alterExtensionContentsStmt *n = makeNode(alterExtensionContentsStmt); n->extname = D; n->action = E; n->objtype = OBJECT_CAST; n->object = (Node *) list_make2(H, J); A = (Node *) n; } alterExtensionContentsStmt(A) ::= ALTER EXTENSION name(D) add_drop(E) DOMAIN_P typename(G). { alterExtensionContentsStmt *n = makeNode(alterExtensionContentsStmt); n->extname = D; n->action = E; n->objtype = OBJECT_DOMAIN; n->object = (Node *) G; A = (Node *) n; } alterExtensionContentsStmt(A) ::= ALTER EXTENSION name(D) add_drop(E) FUNCTION function_with_argtypes(G). { alterExtensionContentsStmt *n = makeNode(alterExtensionContentsStmt); n->extname = D; n->action = E; n->objtype = OBJECT_FUNCTION; n->object = (Node *) G; A = (Node *) n; } alterExtensionContentsStmt(A) ::= ALTER EXTENSION name(D) add_drop(E) OPERATOR operator_with_argtypes(G). { alterExtensionContentsStmt *n = makeNode(alterExtensionContentsStmt); n->extname = D; n->action = E; n->objtype = OBJECT_OPERATOR; n->object = (Node *) G; A = (Node *) n; } alterExtensionContentsStmt(A) ::= ALTER EXTENSION name(D) add_drop(E) OPERATOR CLASS any_name(H) USING name(J). { alterExtensionContentsStmt *n = makeNode(alterExtensionContentsStmt); n->extname = D; n->action = E; n->objtype = OBJECT_OPCLASS; n->object = (Node *) lcons(makeString(J), H); A = (Node *) n; } alterExtensionContentsStmt(A) ::= ALTER EXTENSION name(D) add_drop(E) OPERATOR FAMILY any_name(H) USING name(J). { alterExtensionContentsStmt *n = makeNode(alterExtensionContentsStmt); n->extname = D; n->action = E; n->objtype = OBJECT_OPFAMILY; n->object = (Node *) lcons(makeString(J), H); A = (Node *) n; } alterExtensionContentsStmt(A) ::= ALTER EXTENSION name(D) add_drop(E) PROCEDURE function_with_argtypes(G). { alterExtensionContentsStmt *n = makeNode(alterExtensionContentsStmt); n->extname = D; n->action = E; n->objtype = OBJECT_PROCEDURE; n->object = (Node *) G; A = (Node *) n; } alterExtensionContentsStmt(A) ::= ALTER EXTENSION name(D) add_drop(E) ROUTINE function_with_argtypes(G). { alterExtensionContentsStmt *n = makeNode(alterExtensionContentsStmt); n->extname = D; n->action = E; n->objtype = OBJECT_ROUTINE; n->object = (Node *) G; A = (Node *) n; } alterExtensionContentsStmt(A) ::= ALTER EXTENSION name(D) add_drop(E) TRANSFORM FOR typename(H) LANGUAGE name(J). { alterExtensionContentsStmt *n = makeNode(alterExtensionContentsStmt); n->extname = D; n->action = E; n->objtype = OBJECT_TRANSFORM; n->object = (Node *) list_make2(H, makeString(J)); A = (Node *) n; } alterExtensionContentsStmt(A) ::= ALTER EXTENSION name(D) add_drop(E) TYPE_P typename(G). { alterExtensionContentsStmt *n = makeNode(alterExtensionContentsStmt); n->extname = D; n->action = E; n->objtype = OBJECT_TYPE; n->object = (Node *) G; A = (Node *) n; } /* ----- createFdwStmt ----- */ createFdwStmt(A) ::= CREATE FOREIGN DATA_P WRAPPER name(F) opt_fdw_options(G) create_generic_options(H). { createFdwStmt *n = makeNode(createFdwStmt); n->fdwname = F; n->func_options = G; n->options = H; A = (Node *) n; } /* ----- fdw_option ----- */ fdw_option(A) ::= HANDLER handler_name(C). { A = makeDefElem("handler", (Node *) C, LOC(B)); } fdw_option(A) ::= NO HANDLER. { A = makeDefElem("handler", NULL, LOC(B)); } fdw_option(A) ::= VALIDATOR handler_name(C). { A = makeDefElem("validator", (Node *) C, LOC(B)); } fdw_option(A) ::= NO VALIDATOR. { A = makeDefElem("validator", NULL, LOC(B)); } fdw_option(A) ::= CONNECTION handler_name(C). { A = makeDefElem("connection", (Node *) C, LOC(B)); } fdw_option(A) ::= NO CONNECTION. { A = makeDefElem("connection", NULL, LOC(B)); } /* ----- fdw_options ----- */ fdw_options(A) ::= fdw_option(B). { A = list_make1(B); } fdw_options(A) ::= fdw_options(B) fdw_option(C). { A = lappend(B, C); } /* ----- opt_fdw_options ----- */ opt_fdw_options(A) ::= fdw_options(B). { A = B; } opt_fdw_options(A) ::= . { A = NIL; } /* ----- alterFdwStmt ----- */ alterFdwStmt(A) ::= ALTER FOREIGN DATA_P WRAPPER name(F) opt_fdw_options(G) alter_generic_options(H). { alterFdwStmt *n = makeNode(alterFdwStmt); n->fdwname = F; n->func_options = G; n->options = H; A = (Node *) n; } alterFdwStmt(A) ::= ALTER FOREIGN DATA_P WRAPPER name(F) fdw_options(G). { alterFdwStmt *n = makeNode(alterFdwStmt); n->fdwname = F; n->func_options = G; n->options = NIL; A = (Node *) n; } /* ----- create_generic_options ----- */ create_generic_options(A) ::= OPTIONS LPAREN generic_option_list(D) RPAREN. { A = D; } create_generic_options(A) ::= . { A = NIL; } /* ----- generic_option_list ----- */ generic_option_list(A) ::= generic_option_elem(B). { A = list_make1(B); } generic_option_list(A) ::= generic_option_list(B) COMMA generic_option_elem(D). { A = lappend(B, D); } /* ----- alter_generic_options ----- */ alter_generic_options(A) ::= OPTIONS LPAREN alter_generic_option_list(D) RPAREN. { A = D; } /* ----- alter_generic_option_list ----- */ alter_generic_option_list(A) ::= alter_generic_option_elem(B). { A = list_make1(B); } alter_generic_option_list(A) ::= alter_generic_option_list(B) COMMA alter_generic_option_elem(D). { A = lappend(B, D); } /* ----- alter_generic_option_elem ----- */ alter_generic_option_elem(A) ::= generic_option_elem(B). { A = B; } alter_generic_option_elem(A) ::= SET generic_option_elem(C). { A = C; A->defaction = DEFELEM_SET; } alter_generic_option_elem(A) ::= ADD_P generic_option_elem(C). { A = C; A->defaction = DEFELEM_ADD; } alter_generic_option_elem(A) ::= DROP generic_option_name(C). { A = makeDefElemExtended(NULL, C, NULL, DEFELEM_DROP, LOC(C)); } /* ----- generic_option_elem ----- */ generic_option_elem(A) ::= generic_option_name(B) generic_option_arg(C). { A = makeDefElem(B, C, LOC(B)); } /* ----- generic_option_name ----- */ generic_option_name(A) ::= colLabel(B). { A = B; } /* ----- generic_option_arg ----- */ generic_option_arg(A) ::= sconst(B). { A = (Node *) makeString(B); } /* ----- createForeignServerStmt ----- */ createForeignServerStmt(A) ::= CREATE SERVER name(D) opt_type(E) opt_foreign_server_version(F) FOREIGN DATA_P WRAPPER name(J) create_generic_options(K). { createForeignServerStmt *n = makeNode(createForeignServerStmt); n->servername = D; n->servertype = E; n->version = F; n->fdwname = J; n->options = K; n->if_not_exists = false; A = (Node *) n; } createForeignServerStmt(A) ::= CREATE SERVER IF_P NOT EXISTS name(G) opt_type(H) opt_foreign_server_version(I) FOREIGN DATA_P WRAPPER name(M) create_generic_options(N). { createForeignServerStmt *n = makeNode(createForeignServerStmt); n->servername = G; n->servertype = H; n->version = I; n->fdwname = M; n->options = N; n->if_not_exists = true; A = (Node *) n; } /* ----- opt_type ----- */ opt_type(A) ::= TYPE_P sconst(C). { A = C; } opt_type(A) ::= . { A = NULL; } /* ----- foreign_server_version ----- */ foreign_server_version(A) ::= VERSION_P sconst(C). { A = C; } foreign_server_version(A) ::= VERSION_P NULL_P. { A = NULL; } /* ----- opt_foreign_server_version ----- */ opt_foreign_server_version(A) ::= foreign_server_version(B). { A = B; } opt_foreign_server_version(A) ::= . { A = NULL; } /* ----- alterForeignServerStmt ----- */ alterForeignServerStmt(A) ::= ALTER SERVER name(D) foreign_server_version(E) alter_generic_options(F). { alterForeignServerStmt *n = makeNode(alterForeignServerStmt); n->servername = D; n->version = E; n->options = F; n->has_version = true; A = (Node *) n; } alterForeignServerStmt(A) ::= ALTER SERVER name(D) foreign_server_version(E). { alterForeignServerStmt *n = makeNode(alterForeignServerStmt); n->servername = D; n->version = E; n->has_version = true; A = (Node *) n; } alterForeignServerStmt(A) ::= ALTER SERVER name(D) alter_generic_options(E). { alterForeignServerStmt *n = makeNode(alterForeignServerStmt); n->servername = D; n->options = E; A = (Node *) n; } /* ----- createForeignTableStmt ----- */ createForeignTableStmt(A) ::= CREATE FOREIGN TABLE qualified_name(E) LPAREN optTableElementList(G) RPAREN optInherit(I) SERVER name(K) create_generic_options(L). { createForeignTableStmt *n = makeNode(createForeignTableStmt); E->relpersistence = RELPERSISTENCE_PERMANENT; n->base.relation = E; n->base.tableElts = G; n->base.inhRelations = I; n->base.ofTypename = NULL; n->base.constraints = NIL; n->base.options = NIL; n->base.oncommit = ONCOMMIT_NOOP; n->base.tablespacename = NULL; n->base.if_not_exists = false; n->servername = K; n->options = L; A = (Node *) n; } createForeignTableStmt(A) ::= CREATE FOREIGN TABLE IF_P NOT EXISTS qualified_name(H) LPAREN optTableElementList(J) RPAREN optInherit(L) SERVER name(N) create_generic_options(O). { createForeignTableStmt *n = makeNode(createForeignTableStmt); H->relpersistence = RELPERSISTENCE_PERMANENT; n->base.relation = H; n->base.tableElts = J; n->base.inhRelations = L; n->base.ofTypename = NULL; n->base.constraints = NIL; n->base.options = NIL; n->base.oncommit = ONCOMMIT_NOOP; n->base.tablespacename = NULL; n->base.if_not_exists = true; n->servername = N; n->options = O; A = (Node *) n; } createForeignTableStmt(A) ::= CREATE FOREIGN TABLE qualified_name(E) PARTITION OF qualified_name(H) optTypedTableElementList(I) partitionBoundSpec(J) SERVER name(L) create_generic_options(M). { createForeignTableStmt *n = makeNode(createForeignTableStmt); E->relpersistence = RELPERSISTENCE_PERMANENT; n->base.relation = E; n->base.inhRelations = list_make1(H); n->base.tableElts = I; n->base.partbound = J; n->base.ofTypename = NULL; n->base.constraints = NIL; n->base.options = NIL; n->base.oncommit = ONCOMMIT_NOOP; n->base.tablespacename = NULL; n->base.if_not_exists = false; n->servername = L; n->options = M; A = (Node *) n; } createForeignTableStmt(A) ::= CREATE FOREIGN TABLE IF_P NOT EXISTS qualified_name(H) PARTITION OF qualified_name(K) optTypedTableElementList(L) partitionBoundSpec(M) SERVER name(O) create_generic_options(P). { createForeignTableStmt *n = makeNode(createForeignTableStmt); H->relpersistence = RELPERSISTENCE_PERMANENT; n->base.relation = H; n->base.inhRelations = list_make1(K); n->base.tableElts = L; n->base.partbound = M; n->base.ofTypename = NULL; n->base.constraints = NIL; n->base.options = NIL; n->base.oncommit = ONCOMMIT_NOOP; n->base.tablespacename = NULL; n->base.if_not_exists = true; n->servername = O; n->options = P; A = (Node *) n; } /* ----- importForeignSchemaStmt ----- */ importForeignSchemaStmt(A) ::= IMPORT_P FOREIGN SCHEMA name(E) import_qualification(F) FROM SERVER name(I) INTO name(K) create_generic_options(L). { importForeignSchemaStmt *n = makeNode(importForeignSchemaStmt); n->server_name = I; n->remote_schema = E; n->local_schema = K; n->list_type = F->type; n->table_list = F->table_names; n->options = L; A = (Node *) n; } /* ----- import_qualification_type ----- */ import_qualification_type(A) ::= LIMIT TO. { A = FDW_IMPORT_SCHEMA_LIMIT_TO; } import_qualification_type(A) ::= EXCEPT. { A = FDW_IMPORT_SCHEMA_EXCEPT; } /* ----- import_qualification ----- */ import_qualification(A) ::= import_qualification_type(B) LPAREN relation_expr_list(D) RPAREN. { ImportQual *n = palloc_object(ImportQual); n->type = B; n->table_names = D; A = n; } import_qualification(A) ::= . { ImportQual *n = palloc_object(ImportQual); n->type = FDW_IMPORT_SCHEMA_ALL; n->table_names = NIL; A = n; } /* ----- createUserMappingStmt ----- */ createUserMappingStmt(A) ::= CREATE USER MAPPING FOR auth_ident(F) SERVER name(H) create_generic_options(I). { createUserMappingStmt *n = makeNode(createUserMappingStmt); n->user = F; n->servername = H; n->options = I; n->if_not_exists = false; A = (Node *) n; } createUserMappingStmt(A) ::= CREATE USER MAPPING IF_P NOT EXISTS FOR auth_ident(I) SERVER name(K) create_generic_options(L). { createUserMappingStmt *n = makeNode(createUserMappingStmt); n->user = I; n->servername = K; n->options = L; n->if_not_exists = true; A = (Node *) n; } /* ----- auth_ident ----- */ auth_ident(A) ::= roleSpec(B). { A = B; } auth_ident(A) ::= USER. { A = makeRoleSpec(ROLESPEC_CURRENT_USER, LOC(B)); } /* ----- dropUserMappingStmt ----- */ dropUserMappingStmt(A) ::= DROP USER MAPPING FOR auth_ident(F) SERVER name(H). { dropUserMappingStmt *n = makeNode(dropUserMappingStmt); n->user = F; n->servername = H; n->missing_ok = false; A = (Node *) n; } dropUserMappingStmt(A) ::= DROP USER MAPPING IF_P EXISTS FOR auth_ident(H) SERVER name(J). { dropUserMappingStmt *n = makeNode(dropUserMappingStmt); n->user = H; n->servername = J; n->missing_ok = true; A = (Node *) n; } /* ----- alterUserMappingStmt ----- */ alterUserMappingStmt(A) ::= ALTER USER MAPPING FOR auth_ident(F) SERVER name(H) alter_generic_options(I). { alterUserMappingStmt *n = makeNode(alterUserMappingStmt); n->user = F; n->servername = H; n->options = I; A = (Node *) n; } /* ----- createPolicyStmt ----- */ createPolicyStmt(A) ::= CREATE POLICY name(D) ON qualified_name(F) rowSecurityDefaultPermissive(G) rowSecurityDefaultForCmd(H) rowSecurityDefaultToRole(I) rowSecurityOptionalExpr(J) rowSecurityOptionalWithCheck(K). { createPolicyStmt *n = makeNode(createPolicyStmt); n->policy_name = D; n->table = F; n->permissive = G; n->cmd_name = H; n->roles = I; n->qual = J; n->with_check = K; A = (Node *) n; } /* ----- alterPolicyStmt ----- */ alterPolicyStmt(A) ::= ALTER POLICY name(D) ON qualified_name(F) rowSecurityOptionalToRole(G) rowSecurityOptionalExpr(H) rowSecurityOptionalWithCheck(I). { alterPolicyStmt *n = makeNode(alterPolicyStmt); n->policy_name = D; n->table = F; n->roles = G; n->qual = H; n->with_check = I; A = (Node *) n; } /* ----- rowSecurityOptionalExpr ----- */ rowSecurityOptionalExpr(A) ::= USING LPAREN a_expr(D) RPAREN. { A = D; } rowSecurityOptionalExpr(A) ::= . { A = NULL; } /* ----- rowSecurityOptionalWithCheck ----- */ rowSecurityOptionalWithCheck(A) ::= WITH CHECK LPAREN a_expr(E) RPAREN. { A = E; } rowSecurityOptionalWithCheck(A) ::= . { A = NULL; } /* ----- rowSecurityDefaultToRole ----- */ rowSecurityDefaultToRole(A) ::= TO role_list(C). { A = C; } rowSecurityDefaultToRole(A) ::= . { A = list_make1(makeRoleSpec(ROLESPEC_PUBLIC, -1)); } /* ----- rowSecurityOptionalToRole ----- */ rowSecurityOptionalToRole(A) ::= TO role_list(C). { A = C; } rowSecurityOptionalToRole(A) ::= . { A = NULL; } /* ----- rowSecurityDefaultPermissive ----- */ rowSecurityDefaultPermissive(A) ::= AS IDENT. { if (strcmp(C, "permissive") == 0) A = true; else if (strcmp(C, "restrictive") == 0) A = false; else ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("unrecognized row security option \"%s\"", C), errhint("Only PERMISSIVE or RESTRICTIVE policies are supported currently."), parser_errposition(LOC(C)))); } rowSecurityDefaultPermissive(A) ::= . { A = true; } /* ----- rowSecurityDefaultForCmd ----- */ rowSecurityDefaultForCmd(A) ::= FOR row_security_cmd(C). { A = C; } rowSecurityDefaultForCmd(A) ::= . { A = "all"; } /* ----- row_security_cmd ----- */ row_security_cmd(A) ::= ALL. { A = "all"; } row_security_cmd(A) ::= SELECT. { A = "select"; } row_security_cmd(A) ::= INSERT. { A = "insert"; } row_security_cmd(A) ::= UPDATE. { A = "update"; } row_security_cmd(A) ::= DELETE_P. { A = "delete"; } /* ----- createAmStmt ----- */ createAmStmt(A) ::= CREATE ACCESS METHOD name(E) TYPE_P am_type(G) HANDLER handler_name(I). { createAmStmt *n = makeNode(createAmStmt); n->amname = E; n->handler_name = I; n->amtype = G; A = (Node *) n; } /* ----- am_type ----- */ am_type(A) ::= INDEX. { A = AMTYPE_INDEX; } am_type(A) ::= TABLE. { A = AMTYPE_TABLE; } /* ----- createTrigStmt ----- */ createTrigStmt(A) ::= CREATE opt_or_replace(C) TRIGGER name(E) triggerActionTime(F) triggerEvents(G) ON qualified_name(I) triggerReferencing(J) triggerForSpec(K) triggerWhen(L) EXECUTE fUNCTION_or_PROCEDURE(N) func_name(O) LPAREN triggerFuncArgs(Q) RPAREN. { createTrigStmt *n = makeNode(createTrigStmt); n->replace = C; n->isconstraint = false; n->trigname = E; n->relation = I; n->funcname = O; n->args = Q; n->row = K; n->timing = F; n->events = intVal(linitial(G)); n->columns = (List *) lsecond(G); n->whenClause = L; n->transitionRels = J; n->deferrable = false; n->initdeferred = false; n->constrrel = NULL; A = (Node *) n; } createTrigStmt(A) ::= CREATE opt_or_replace(C) CONSTRAINT TRIGGER name(F) AFTER triggerEvents(H) ON qualified_name(J) optConstrFromTable(K) constraintAttributeSpec(L) FOR EACH ROW triggerWhen(P) EXECUTE fUNCTION_or_PROCEDURE(R) func_name(S) LPAREN triggerFuncArgs(U) RPAREN. { createTrigStmt *n = makeNode(createTrigStmt); bool dummy; if ((L & CAS_NOT_VALID) != 0) ereport(ERROR, errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("constraint triggers cannot be marked %s", "NOT VALID"), parser_errposition(LOC(L))); if ((L & CAS_NO_INHERIT) != 0) ereport(ERROR, errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("constraint triggers cannot be marked %s", "NO INHERIT"), parser_errposition(LOC(L))); if ((L & CAS_NOT_ENFORCED) != 0) ereport(ERROR, errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("constraint triggers cannot be marked %s", "NOT ENFORCED"), parser_errposition(LOC(L))); n->replace = C; if (n->replace) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("CREATE OR REPLACE CONSTRAINT TRIGGER is not supported"), parser_errposition(LOC(B)))); n->isconstraint = true; n->trigname = F; n->relation = J; n->funcname = S; n->args = U; n->row = true; n->timing = TRIGGER_TYPE_AFTER; n->events = intVal(linitial(H)); n->columns = (List *) lsecond(H); n->whenClause = P; n->transitionRels = NIL; processCASbits(L, LOC(L), "TRIGGER", &n->deferrable, &n->initdeferred, &dummy, NULL, NULL, yyscanner); n->constrrel = K; A = (Node *) n; } /* ----- triggerActionTime ----- */ triggerActionTime(A) ::= BEFORE. { A = TRIGGER_TYPE_BEFORE; } triggerActionTime(A) ::= AFTER. { A = TRIGGER_TYPE_AFTER; } triggerActionTime(A) ::= INSTEAD OF. { A = TRIGGER_TYPE_INSTEAD; } /* ----- triggerEvents ----- */ triggerEvents(A) ::= triggerOneEvent(B). { A = B; } triggerEvents(A) ::= triggerEvents(B) OR triggerOneEvent(D). { int events1 = intVal(linitial(B)); int events2 = intVal(linitial(D)); List *columns1 = (List *) lsecond(B); List *columns2 = (List *) lsecond(D); if (events1 & events2) parser_yyerror("duplicate trigger events specified"); A = list_make2(makeInteger(events1 | events2), list_concat(columns1, columns2)); } /* ----- triggerOneEvent ----- */ triggerOneEvent(A) ::= INSERT. { A = list_make2(makeInteger(TRIGGER_TYPE_INSERT), NIL); } triggerOneEvent(A) ::= DELETE_P. { A = list_make2(makeInteger(TRIGGER_TYPE_DELETE), NIL); } triggerOneEvent(A) ::= UPDATE. { A = list_make2(makeInteger(TRIGGER_TYPE_UPDATE), NIL); } triggerOneEvent(A) ::= UPDATE OF columnList(D). { A = list_make2(makeInteger(TRIGGER_TYPE_UPDATE), D); } triggerOneEvent(A) ::= TRUNCATE. { A = list_make2(makeInteger(TRIGGER_TYPE_TRUNCATE), NIL); } /* ----- triggerReferencing ----- */ triggerReferencing(A) ::= REFERENCING triggerTransitions(C). { A = C; } triggerReferencing(A) ::= . { A = NIL; } /* ----- triggerTransitions ----- */ triggerTransitions(A) ::= triggerTransition(B). { A = list_make1(B); } triggerTransitions(A) ::= triggerTransitions(B) triggerTransition(C). { A = lappend(B, C); } /* ----- triggerTransition ----- */ triggerTransition(A) ::= transitionOldOrNew(B) transitionRowOrTable(C) opt_as(D) transitionRelName(E). { triggerTransition *n = makeNode(triggerTransition); n->name = E; n->isNew = B; n->isTable = C; A = (Node *) n; } /* ----- transitionOldOrNew ----- */ transitionOldOrNew(A) ::= NEW. { A = true; } transitionOldOrNew(A) ::= OLD. { A = false; } /* ----- transitionRowOrTable ----- */ transitionRowOrTable(A) ::= TABLE. { A = true; } transitionRowOrTable(A) ::= ROW. { A = false; } /* ----- transitionRelName ----- */ transitionRelName(A) ::= colId(B). { A = B; } /* ----- triggerForSpec ----- */ triggerForSpec(A) ::= FOR triggerForOptEach(C) triggerForType(D). { A = D; } triggerForSpec(A) ::= . { A = false; } /* ----- triggerForOptEach ----- */ triggerForOptEach(A) ::= EACH. /* ----- triggerForType ----- */ triggerForType(A) ::= ROW. { A = true; } triggerForType(A) ::= STATEMENT. { A = false; } /* ----- triggerWhen ----- */ triggerWhen(A) ::= WHEN LPAREN a_expr(D) RPAREN. { A = D; } triggerWhen(A) ::= . { A = NULL; } /* ----- fUNCTION_or_PROCEDURE ----- */ fUNCTION_or_PROCEDURE(A) ::= FUNCTION. fUNCTION_or_PROCEDURE(A) ::= PROCEDURE. /* ----- triggerFuncArgs ----- */ triggerFuncArgs(A) ::= triggerFuncArg(B). { A = list_make1(B); } triggerFuncArgs(A) ::= triggerFuncArgs(B) COMMA triggerFuncArg(D). { A = lappend(B, D); } triggerFuncArgs(A) ::= . { A = NIL; } /* ----- triggerFuncArg ----- */ triggerFuncArg(A) ::= iconst(B). { A = (Node *) makeString(psprintf("%d", B)); } triggerFuncArg(A) ::= FCONST. { A = (Node *) makeString(B); } triggerFuncArg(A) ::= sconst(B). { A = (Node *) makeString(B); } triggerFuncArg(A) ::= colLabel(B). { A = (Node *) makeString(B); } /* ----- optConstrFromTable ----- */ optConstrFromTable(A) ::= FROM qualified_name(C). { A = C; } optConstrFromTable(A) ::= . { A = NULL; } /* ----- constraintAttributeSpec ----- */ constraintAttributeSpec(A) ::= . { A = 0; } constraintAttributeSpec(A) ::= constraintAttributeSpec(B) constraintAttributeElem(C). { int newspec = B | C; if ((newspec & (CAS_NOT_DEFERRABLE | CAS_INITIALLY_DEFERRED)) == (CAS_NOT_DEFERRABLE | CAS_INITIALLY_DEFERRED)) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("constraint declared INITIALLY DEFERRED must be DEFERRABLE"), parser_errposition(LOC(C)))); if ((newspec & (CAS_NOT_DEFERRABLE | CAS_DEFERRABLE)) == (CAS_NOT_DEFERRABLE | CAS_DEFERRABLE) || (newspec & (CAS_INITIALLY_IMMEDIATE | CAS_INITIALLY_DEFERRED)) == (CAS_INITIALLY_IMMEDIATE | CAS_INITIALLY_DEFERRED) || (newspec & (CAS_NOT_ENFORCED | CAS_ENFORCED)) == (CAS_NOT_ENFORCED | CAS_ENFORCED)) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("conflicting constraint properties"), parser_errposition(LOC(C)))); A = newspec; } /* ----- constraintAttributeElem ----- */ constraintAttributeElem(A) ::= NOT DEFERRABLE. { A = CAS_NOT_DEFERRABLE; } constraintAttributeElem(A) ::= DEFERRABLE. { A = CAS_DEFERRABLE; } constraintAttributeElem(A) ::= INITIALLY IMMEDIATE. { A = CAS_INITIALLY_IMMEDIATE; } constraintAttributeElem(A) ::= INITIALLY DEFERRED. { A = CAS_INITIALLY_DEFERRED; } constraintAttributeElem(A) ::= NOT VALID. { A = CAS_NOT_VALID; } constraintAttributeElem(A) ::= NO INHERIT. { A = CAS_NO_INHERIT; } constraintAttributeElem(A) ::= NOT ENFORCED. { A = CAS_NOT_ENFORCED; } constraintAttributeElem(A) ::= ENFORCED. { A = CAS_ENFORCED; } /* ----- createEventTrigStmt ----- */ createEventTrigStmt(A) ::= CREATE EVENT TRIGGER name(E) ON colLabel(G) EXECUTE fUNCTION_or_PROCEDURE(I) func_name(J) LPAREN RPAREN. { createEventTrigStmt *n = makeNode(createEventTrigStmt); n->trigname = E; n->eventname = G; n->whenclause = NULL; n->funcname = J; A = (Node *) n; } createEventTrigStmt(A) ::= CREATE EVENT TRIGGER name(E) ON colLabel(G) WHEN event_trigger_when_list(I) EXECUTE fUNCTION_or_PROCEDURE(K) func_name(L) LPAREN RPAREN. { createEventTrigStmt *n = makeNode(createEventTrigStmt); n->trigname = E; n->eventname = G; n->whenclause = I; n->funcname = L; A = (Node *) n; } /* ----- event_trigger_when_list ----- */ event_trigger_when_list(A) ::= event_trigger_when_item(B). { A = list_make1(B); } event_trigger_when_list(A) ::= event_trigger_when_list(B) AND event_trigger_when_item(D). { A = lappend(B, D); } /* ----- event_trigger_when_item ----- */ event_trigger_when_item(A) ::= colId(B) IN_P LPAREN event_trigger_value_list(E) RPAREN. { A = makeDefElem(B, (Node *) E, LOC(B)); } /* ----- event_trigger_value_list ----- */ event_trigger_value_list(A) ::= SCONST. { A = list_make1(makeString(B)); } event_trigger_value_list(A) ::= event_trigger_value_list(B) COMMA SCONST. { A = lappend(B, makeString(D)); } /* ----- alterEventTrigStmt ----- */ alterEventTrigStmt(A) ::= ALTER EVENT TRIGGER name(E) enable_trigger(F). { alterEventTrigStmt *n = makeNode(alterEventTrigStmt); n->trigname = E; n->tgenabled = F; A = (Node *) n; } /* ----- enable_trigger ----- */ enable_trigger(A) ::= ENABLE_P. { A = TRIGGER_FIRES_ON_ORIGIN; } enable_trigger(A) ::= ENABLE_P REPLICA. { A = TRIGGER_FIRES_ON_REPLICA; } enable_trigger(A) ::= ENABLE_P ALWAYS. { A = TRIGGER_FIRES_ALWAYS; } enable_trigger(A) ::= DISABLE_P. { A = TRIGGER_DISABLED; } /* ----- createAssertionStmt ----- */ createAssertionStmt(A) ::= CREATE ASSERTION any_name(D) CHECK LPAREN a_expr(G) RPAREN constraintAttributeSpec(I). { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("CREATE ASSERTION is not yet implemented"), parser_errposition(LOC(B)))); A = NULL; } /* ----- defineStmt ----- */ defineStmt(A) ::= CREATE opt_or_replace(C) AGGREGATE func_name(E) aggr_args(F) definition(G). { defineStmt *n = makeNode(defineStmt); n->kind = OBJECT_AGGREGATE; n->oldstyle = false; n->replace = C; n->defnames = E; n->args = F; n->definition = G; A = (Node *) n; } defineStmt(A) ::= CREATE opt_or_replace(C) AGGREGATE func_name(E) old_aggr_definition(F). { defineStmt *n = makeNode(defineStmt); n->kind = OBJECT_AGGREGATE; n->oldstyle = true; n->replace = C; n->defnames = E; n->args = NIL; n->definition = F; A = (Node *) n; } defineStmt(A) ::= CREATE OPERATOR any_operator(D) definition(E). { defineStmt *n = makeNode(defineStmt); n->kind = OBJECT_OPERATOR; n->oldstyle = false; n->defnames = D; n->args = NIL; n->definition = E; A = (Node *) n; } defineStmt(A) ::= CREATE TYPE_P any_name(D) definition(E). { defineStmt *n = makeNode(defineStmt); n->kind = OBJECT_TYPE; n->oldstyle = false; n->defnames = D; n->args = NIL; n->definition = E; A = (Node *) n; } defineStmt(A) ::= CREATE TYPE_P any_name(D). { defineStmt *n = makeNode(defineStmt); n->kind = OBJECT_TYPE; n->oldstyle = false; n->defnames = D; n->args = NIL; n->definition = NIL; A = (Node *) n; } defineStmt(A) ::= CREATE TYPE_P any_name(D) AS LPAREN optTableFuncElementList(G) RPAREN. { CompositeTypeStmt *n = makeNode(CompositeTypeStmt); n->typevar = makeRangeVarFromAnyName(D, LOC(D), yyscanner); n->coldeflist = G; A = (Node *) n; } defineStmt(A) ::= CREATE TYPE_P any_name(D) AS ENUM_P LPAREN opt_enum_val_list(H) RPAREN. { CreateEnumStmt *n = makeNode(CreateEnumStmt); n->typeName = D; n->vals = H; A = (Node *) n; } defineStmt(A) ::= CREATE TYPE_P any_name(D) AS RANGE definition(G). { CreateRangeStmt *n = makeNode(CreateRangeStmt); n->typeName = D; n->params = G; A = (Node *) n; } defineStmt(A) ::= CREATE TEXT_P SEARCH PARSER any_name(F) definition(G). { defineStmt *n = makeNode(defineStmt); n->kind = OBJECT_TSPARSER; n->args = NIL; n->defnames = F; n->definition = G; A = (Node *) n; } defineStmt(A) ::= CREATE TEXT_P SEARCH DICTIONARY any_name(F) definition(G). { defineStmt *n = makeNode(defineStmt); n->kind = OBJECT_TSDICTIONARY; n->args = NIL; n->defnames = F; n->definition = G; A = (Node *) n; } defineStmt(A) ::= CREATE TEXT_P SEARCH TEMPLATE any_name(F) definition(G). { defineStmt *n = makeNode(defineStmt); n->kind = OBJECT_TSTEMPLATE; n->args = NIL; n->defnames = F; n->definition = G; A = (Node *) n; } defineStmt(A) ::= CREATE TEXT_P SEARCH CONFIGURATION any_name(F) definition(G). { defineStmt *n = makeNode(defineStmt); n->kind = OBJECT_TSCONFIGURATION; n->args = NIL; n->defnames = F; n->definition = G; A = (Node *) n; } defineStmt(A) ::= CREATE COLLATION any_name(D) definition(E). { defineStmt *n = makeNode(defineStmt); n->kind = OBJECT_COLLATION; n->args = NIL; n->defnames = D; n->definition = E; A = (Node *) n; } defineStmt(A) ::= CREATE COLLATION IF_P NOT EXISTS any_name(G) definition(H). { defineStmt *n = makeNode(defineStmt); n->kind = OBJECT_COLLATION; n->args = NIL; n->defnames = G; n->definition = H; n->if_not_exists = true; A = (Node *) n; } defineStmt(A) ::= CREATE COLLATION any_name(D) FROM any_name(F). { defineStmt *n = makeNode(defineStmt); n->kind = OBJECT_COLLATION; n->args = NIL; n->defnames = D; n->definition = list_make1(makeDefElem("from", (Node *) F, LOC(F))); A = (Node *) n; } defineStmt(A) ::= CREATE COLLATION IF_P NOT EXISTS any_name(G) FROM any_name(I). { defineStmt *n = makeNode(defineStmt); n->kind = OBJECT_COLLATION; n->args = NIL; n->defnames = G; n->definition = list_make1(makeDefElem("from", (Node *) I, LOC(I))); n->if_not_exists = true; A = (Node *) n; } /* ----- definition ----- */ definition(A) ::= LPAREN def_list(C) RPAREN. { A = C; } /* ----- def_list ----- */ def_list(A) ::= def_elem(B). { A = list_make1(B); } def_list(A) ::= def_list(B) COMMA def_elem(D). { A = lappend(B, D); } /* ----- def_elem ----- */ def_elem(A) ::= colLabel(B) EQ def_arg(D). { A = makeDefElem(B, (Node *) D, LOC(B)); } def_elem(A) ::= colLabel(B). { A = makeDefElem(B, NULL, LOC(B)); } /* ----- def_arg ----- */ def_arg(A) ::= func_type(B). { A = (Node *) B; } def_arg(A) ::= reserved_keyword(B). { A = (Node *) makeString(pstrdup(B)); } def_arg(A) ::= qual_all_Op(B). { A = (Node *) B; } def_arg(A) ::= numericOnly(B). { A = (Node *) B; } def_arg(A) ::= sconst(B). { A = (Node *) makeString(B); } def_arg(A) ::= NONE. { A = (Node *) makeString(pstrdup(B)); } /* ----- old_aggr_definition ----- */ old_aggr_definition(A) ::= LPAREN old_aggr_list(C) RPAREN. { A = C; } /* ----- old_aggr_list ----- */ old_aggr_list(A) ::= old_aggr_elem(B). { A = list_make1(B); } old_aggr_list(A) ::= old_aggr_list(B) COMMA old_aggr_elem(D). { A = lappend(B, D); } /* ----- old_aggr_elem ----- */ old_aggr_elem(A) ::= IDENT EQ def_arg(D). { A = makeDefElem(B, (Node *) D, LOC(B)); } /* ----- opt_enum_val_list ----- */ opt_enum_val_list(A) ::= enum_val_list(B). { A = B; } opt_enum_val_list(A) ::= . { A = NIL; } /* ----- enum_val_list ----- */ enum_val_list(A) ::= sconst(B). { A = list_make1(makeString(B)); } enum_val_list(A) ::= enum_val_list(B) COMMA sconst(D). { A = lappend(B, makeString(D)); } /* ----- alterEnumStmt ----- */ alterEnumStmt(A) ::= ALTER TYPE_P any_name(D) ADD_P VALUE_P opt_if_not_exists(G) sconst(H). { alterEnumStmt *n = makeNode(alterEnumStmt); n->typeName = D; n->oldVal = NULL; n->newVal = H; n->newValNeighbor = NULL; n->newValIsAfter = true; n->skipIfNewValExists = G; A = (Node *) n; } alterEnumStmt(A) ::= ALTER TYPE_P any_name(D) ADD_P VALUE_P opt_if_not_exists(G) sconst(H) BEFORE sconst(J). { alterEnumStmt *n = makeNode(alterEnumStmt); n->typeName = D; n->oldVal = NULL; n->newVal = H; n->newValNeighbor = J; n->newValIsAfter = false; n->skipIfNewValExists = G; A = (Node *) n; } alterEnumStmt(A) ::= ALTER TYPE_P any_name(D) ADD_P VALUE_P opt_if_not_exists(G) sconst(H) AFTER sconst(J). { alterEnumStmt *n = makeNode(alterEnumStmt); n->typeName = D; n->oldVal = NULL; n->newVal = H; n->newValNeighbor = J; n->newValIsAfter = true; n->skipIfNewValExists = G; A = (Node *) n; } alterEnumStmt(A) ::= ALTER TYPE_P any_name(D) RENAME VALUE_P sconst(G) TO sconst(I). { alterEnumStmt *n = makeNode(alterEnumStmt); n->typeName = D; n->oldVal = G; n->newVal = I; n->newValNeighbor = NULL; n->newValIsAfter = false; n->skipIfNewValExists = false; A = (Node *) n; } alterEnumStmt(A) ::= ALTER TYPE_P any_name(D) DROP VALUE_P sconst(G). { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("dropping an enum value is not implemented"), parser_errposition(LOC(E)))); } /* ----- opt_if_not_exists ----- */ opt_if_not_exists(A) ::= IF_P NOT EXISTS. { A = true; } opt_if_not_exists(A) ::= . { A = false; } /* ----- createOpClassStmt ----- */ createOpClassStmt(A) ::= CREATE OPERATOR CLASS any_name(E) opt_default(F) FOR TYPE_P typename(I) USING name(K) opt_opfamily(L) AS opclass_item_list(N). { createOpClassStmt *n = makeNode(createOpClassStmt); n->opclassname = E; n->isDefault = F; n->datatype = I; n->amname = K; n->opfamilyname = L; n->items = N; A = (Node *) n; } /* ----- opclass_item_list ----- */ opclass_item_list(A) ::= opclass_item(B). { A = list_make1(B); } opclass_item_list(A) ::= opclass_item_list(B) COMMA opclass_item(D). { A = lappend(B, D); } /* ----- opclass_item ----- */ opclass_item(A) ::= OPERATOR iconst(C) any_operator(D) opclass_purpose(E). { CreateOpClassItem *n = makeNode(CreateOpClassItem); ObjectWithArgs *owa = makeNode(ObjectWithArgs); owa->objname = D; owa->objargs = NIL; n->itemtype = OPCLASS_ITEM_OPERATOR; n->name = owa; n->number = C; n->order_family = E; A = (Node *) n; } opclass_item(A) ::= OPERATOR iconst(C) operator_with_argtypes(D) opclass_purpose(E). { CreateOpClassItem *n = makeNode(CreateOpClassItem); n->itemtype = OPCLASS_ITEM_OPERATOR; n->name = D; n->number = C; n->order_family = E; A = (Node *) n; } opclass_item(A) ::= FUNCTION iconst(C) function_with_argtypes(D). { CreateOpClassItem *n = makeNode(CreateOpClassItem); n->itemtype = OPCLASS_ITEM_FUNCTION; n->name = D; n->number = C; A = (Node *) n; } opclass_item(A) ::= FUNCTION iconst(C) LPAREN type_list(E) RPAREN function_with_argtypes(G). { CreateOpClassItem *n = makeNode(CreateOpClassItem); n->itemtype = OPCLASS_ITEM_FUNCTION; n->name = G; n->number = C; n->class_args = E; A = (Node *) n; } opclass_item(A) ::= STORAGE typename(C). { CreateOpClassItem *n = makeNode(CreateOpClassItem); n->itemtype = OPCLASS_ITEM_STORAGETYPE; n->storedtype = C; A = (Node *) n; } /* ----- opt_default ----- */ opt_default(A) ::= DEFAULT. { A = true; } opt_default(A) ::= . { A = false; } /* ----- opt_opfamily ----- */ opt_opfamily(A) ::= FAMILY any_name(C). { A = C; } opt_opfamily(A) ::= . { A = NIL; } /* ----- opclass_purpose ----- */ opclass_purpose(A) ::= FOR SEARCH. { A = NIL; } opclass_purpose(A) ::= FOR ORDER BY any_name(E). { A = E; } opclass_purpose(A) ::= . { A = NIL; } /* ----- createOpFamilyStmt ----- */ createOpFamilyStmt(A) ::= CREATE OPERATOR FAMILY any_name(E) USING name(G). { createOpFamilyStmt *n = makeNode(createOpFamilyStmt); n->opfamilyname = E; n->amname = G; A = (Node *) n; } /* ----- alterOpFamilyStmt ----- */ alterOpFamilyStmt(A) ::= ALTER OPERATOR FAMILY any_name(E) USING name(G) ADD_P opclass_item_list(I). { alterOpFamilyStmt *n = makeNode(alterOpFamilyStmt); n->opfamilyname = E; n->amname = G; n->isDrop = false; n->items = I; A = (Node *) n; } alterOpFamilyStmt(A) ::= ALTER OPERATOR FAMILY any_name(E) USING name(G) DROP opclass_drop_list(I). { alterOpFamilyStmt *n = makeNode(alterOpFamilyStmt); n->opfamilyname = E; n->amname = G; n->isDrop = true; n->items = I; A = (Node *) n; } /* ----- opclass_drop_list ----- */ opclass_drop_list(A) ::= opclass_drop(B). { A = list_make1(B); } opclass_drop_list(A) ::= opclass_drop_list(B) COMMA opclass_drop(D). { A = lappend(B, D); } /* ----- opclass_drop ----- */ opclass_drop(A) ::= OPERATOR iconst(C) LPAREN type_list(E) RPAREN. { CreateOpClassItem *n = makeNode(CreateOpClassItem); n->itemtype = OPCLASS_ITEM_OPERATOR; n->number = C; n->class_args = E; A = (Node *) n; } opclass_drop(A) ::= FUNCTION iconst(C) LPAREN type_list(E) RPAREN. { CreateOpClassItem *n = makeNode(CreateOpClassItem); n->itemtype = OPCLASS_ITEM_FUNCTION; n->number = C; n->class_args = E; A = (Node *) n; } /* ----- dropOpClassStmt ----- */ dropOpClassStmt(A) ::= DROP OPERATOR CLASS any_name(E) USING name(G) opt_drop_behavior(H). { dropStmt *n = makeNode(dropStmt); n->objects = list_make1(lcons(makeString(G), E)); n->removeType = OBJECT_OPCLASS; n->behavior = H; n->missing_ok = false; n->concurrent = false; A = (Node *) n; } dropOpClassStmt(A) ::= DROP OPERATOR CLASS IF_P EXISTS any_name(G) USING name(I) opt_drop_behavior(J). { dropStmt *n = makeNode(dropStmt); n->objects = list_make1(lcons(makeString(I), G)); n->removeType = OBJECT_OPCLASS; n->behavior = J; n->missing_ok = true; n->concurrent = false; A = (Node *) n; } /* ----- dropOpFamilyStmt ----- */ dropOpFamilyStmt(A) ::= DROP OPERATOR FAMILY any_name(E) USING name(G) opt_drop_behavior(H). { dropStmt *n = makeNode(dropStmt); n->objects = list_make1(lcons(makeString(G), E)); n->removeType = OBJECT_OPFAMILY; n->behavior = H; n->missing_ok = false; n->concurrent = false; A = (Node *) n; } dropOpFamilyStmt(A) ::= DROP OPERATOR FAMILY IF_P EXISTS any_name(G) USING name(I) opt_drop_behavior(J). { dropStmt *n = makeNode(dropStmt); n->objects = list_make1(lcons(makeString(I), G)); n->removeType = OBJECT_OPFAMILY; n->behavior = J; n->missing_ok = true; n->concurrent = false; A = (Node *) n; } /* ----- dropOwnedStmt ----- */ dropOwnedStmt(A) ::= DROP OWNED BY role_list(E) opt_drop_behavior(F). { dropOwnedStmt *n = makeNode(dropOwnedStmt); n->roles = E; n->behavior = F; A = (Node *) n; } /* ----- reassignOwnedStmt ----- */ reassignOwnedStmt(A) ::= REASSIGN OWNED BY role_list(E) TO roleSpec(G). { reassignOwnedStmt *n = makeNode(reassignOwnedStmt); n->roles = E; n->newrole = G; A = (Node *) n; } /* ----- dropStmt ----- */ dropStmt(A) ::= DROP object_type_any_name(C) IF_P EXISTS any_name_list(F) opt_drop_behavior(G). { dropStmt *n = makeNode(dropStmt); n->removeType = C; n->missing_ok = true; n->objects = F; n->behavior = G; n->concurrent = false; A = (Node *) n; } dropStmt(A) ::= DROP object_type_any_name(C) any_name_list(D) opt_drop_behavior(E). { dropStmt *n = makeNode(dropStmt); n->removeType = C; n->missing_ok = false; n->objects = D; n->behavior = E; n->concurrent = false; A = (Node *) n; } dropStmt(A) ::= DROP drop_type_name(C) IF_P EXISTS name_list(F) opt_drop_behavior(G). { dropStmt *n = makeNode(dropStmt); n->removeType = C; n->missing_ok = true; n->objects = F; n->behavior = G; n->concurrent = false; A = (Node *) n; } dropStmt(A) ::= DROP drop_type_name(C) name_list(D) opt_drop_behavior(E). { dropStmt *n = makeNode(dropStmt); n->removeType = C; n->missing_ok = false; n->objects = D; n->behavior = E; n->concurrent = false; A = (Node *) n; } dropStmt(A) ::= DROP object_type_name_on_any_name(C) name(D) ON any_name(F) opt_drop_behavior(G). { dropStmt *n = makeNode(dropStmt); n->removeType = C; n->objects = list_make1(lappend(F, makeString(D))); n->behavior = G; n->missing_ok = false; n->concurrent = false; A = (Node *) n; } dropStmt(A) ::= DROP object_type_name_on_any_name(C) IF_P EXISTS name(F) ON any_name(H) opt_drop_behavior(I). { dropStmt *n = makeNode(dropStmt); n->removeType = C; n->objects = list_make1(lappend(H, makeString(F))); n->behavior = I; n->missing_ok = true; n->concurrent = false; A = (Node *) n; } dropStmt(A) ::= DROP TYPE_P type_name_list(D) opt_drop_behavior(E). { dropStmt *n = makeNode(dropStmt); n->removeType = OBJECT_TYPE; n->missing_ok = false; n->objects = D; n->behavior = E; n->concurrent = false; A = (Node *) n; } dropStmt(A) ::= DROP TYPE_P IF_P EXISTS type_name_list(F) opt_drop_behavior(G). { dropStmt *n = makeNode(dropStmt); n->removeType = OBJECT_TYPE; n->missing_ok = true; n->objects = F; n->behavior = G; n->concurrent = false; A = (Node *) n; } dropStmt(A) ::= DROP DOMAIN_P type_name_list(D) opt_drop_behavior(E). { dropStmt *n = makeNode(dropStmt); n->removeType = OBJECT_DOMAIN; n->missing_ok = false; n->objects = D; n->behavior = E; n->concurrent = false; A = (Node *) n; } dropStmt(A) ::= DROP DOMAIN_P IF_P EXISTS type_name_list(F) opt_drop_behavior(G). { dropStmt *n = makeNode(dropStmt); n->removeType = OBJECT_DOMAIN; n->missing_ok = true; n->objects = F; n->behavior = G; n->concurrent = false; A = (Node *) n; } dropStmt(A) ::= DROP INDEX CONCURRENTLY any_name_list(E) opt_drop_behavior(F). { dropStmt *n = makeNode(dropStmt); n->removeType = OBJECT_INDEX; n->missing_ok = false; n->objects = E; n->behavior = F; n->concurrent = true; A = (Node *) n; } dropStmt(A) ::= DROP INDEX CONCURRENTLY IF_P EXISTS any_name_list(G) opt_drop_behavior(H). { dropStmt *n = makeNode(dropStmt); n->removeType = OBJECT_INDEX; n->missing_ok = true; n->objects = G; n->behavior = H; n->concurrent = true; A = (Node *) n; } /* ----- object_type_any_name ----- */ object_type_any_name(A) ::= TABLE. { A = OBJECT_TABLE; } object_type_any_name(A) ::= SEQUENCE. { A = OBJECT_SEQUENCE; } object_type_any_name(A) ::= VIEW. { A = OBJECT_VIEW; } object_type_any_name(A) ::= MATERIALIZED VIEW. { A = OBJECT_MATVIEW; } object_type_any_name(A) ::= INDEX. { A = OBJECT_INDEX; } object_type_any_name(A) ::= FOREIGN TABLE. { A = OBJECT_FOREIGN_TABLE; } object_type_any_name(A) ::= PROPERTY GRAPH. { A = OBJECT_PROPGRAPH; } object_type_any_name(A) ::= COLLATION. { A = OBJECT_COLLATION; } object_type_any_name(A) ::= CONVERSION_P. { A = OBJECT_CONVERSION; } object_type_any_name(A) ::= STATISTICS. { A = OBJECT_STATISTIC_EXT; } object_type_any_name(A) ::= TEXT_P SEARCH PARSER. { A = OBJECT_TSPARSER; } object_type_any_name(A) ::= TEXT_P SEARCH DICTIONARY. { A = OBJECT_TSDICTIONARY; } object_type_any_name(A) ::= TEXT_P SEARCH TEMPLATE. { A = OBJECT_TSTEMPLATE; } object_type_any_name(A) ::= TEXT_P SEARCH CONFIGURATION. { A = OBJECT_TSCONFIGURATION; } /* ----- object_type_name ----- */ object_type_name(A) ::= drop_type_name(B). { A = B; } object_type_name(A) ::= DATABASE. { A = OBJECT_DATABASE; } object_type_name(A) ::= ROLE. { A = OBJECT_ROLE; } object_type_name(A) ::= SUBSCRIPTION. { A = OBJECT_SUBSCRIPTION; } object_type_name(A) ::= TABLESPACE. { A = OBJECT_TABLESPACE; } /* ----- drop_type_name ----- */ drop_type_name(A) ::= ACCESS METHOD. { A = OBJECT_ACCESS_METHOD; } drop_type_name(A) ::= EVENT TRIGGER. { A = OBJECT_EVENT_TRIGGER; } drop_type_name(A) ::= EXTENSION. { A = OBJECT_EXTENSION; } drop_type_name(A) ::= FOREIGN DATA_P WRAPPER. { A = OBJECT_FDW; } drop_type_name(A) ::= opt_procedural(B) LANGUAGE. { A = OBJECT_LANGUAGE; } drop_type_name(A) ::= PUBLICATION. { A = OBJECT_PUBLICATION; } drop_type_name(A) ::= SCHEMA. { A = OBJECT_SCHEMA; } drop_type_name(A) ::= SERVER. { A = OBJECT_FOREIGN_SERVER; } /* ----- object_type_name_on_any_name ----- */ object_type_name_on_any_name(A) ::= POLICY. { A = OBJECT_POLICY; } object_type_name_on_any_name(A) ::= RULE. { A = OBJECT_RULE; } object_type_name_on_any_name(A) ::= TRIGGER. { A = OBJECT_TRIGGER; } /* ----- any_name_list ----- */ any_name_list(A) ::= any_name(B). { A = list_make1(B); } any_name_list(A) ::= any_name_list(B) COMMA any_name(D). { A = lappend(B, D); } /* ----- any_name ----- */ any_name(A) ::= colId(B). { A = list_make1(makeString(B)); } any_name(A) ::= colId(B) attrs(C). { A = lcons(makeString(B), C); } /* ----- attrs ----- */ attrs(A) ::= DOT attr_name(C). { A = list_make1(makeString(C)); } attrs(A) ::= attrs(B) DOT attr_name(D). { A = lappend(B, makeString(D)); } /* ----- type_name_list ----- */ type_name_list(A) ::= typename(B). { A = list_make1(B); } type_name_list(A) ::= type_name_list(B) COMMA typename(D). { A = lappend(B, D); } /* ----- truncateStmt ----- */ truncateStmt(A) ::= TRUNCATE opt_table(C) relation_expr_list(D) opt_restart_seqs(E) opt_drop_behavior(F). { truncateStmt *n = makeNode(truncateStmt); n->relations = D; n->restart_seqs = E; n->behavior = F; A = (Node *) n; } /* ----- opt_restart_seqs ----- */ opt_restart_seqs(A) ::= CONTINUE_P IDENTITY_P. { A = false; } opt_restart_seqs(A) ::= RESTART IDENTITY_P. { A = true; } opt_restart_seqs(A) ::= . { A = false; } /* ----- commentStmt ----- */ commentStmt(A) ::= COMMENT ON object_type_any_name(D) any_name(E) IS comment_text(G). { commentStmt *n = makeNode(commentStmt); n->objtype = D; n->object = (Node *) E; n->comment = G; A = (Node *) n; } commentStmt(A) ::= COMMENT ON COLUMN any_name(E) IS comment_text(G). { commentStmt *n = makeNode(commentStmt); n->objtype = OBJECT_COLUMN; n->object = (Node *) E; n->comment = G; A = (Node *) n; } commentStmt(A) ::= COMMENT ON object_type_name(D) name(E) IS comment_text(G). { commentStmt *n = makeNode(commentStmt); n->objtype = D; n->object = (Node *) makeString(E); n->comment = G; A = (Node *) n; } commentStmt(A) ::= COMMENT ON TYPE_P typename(E) IS comment_text(G). { commentStmt *n = makeNode(commentStmt); n->objtype = OBJECT_TYPE; n->object = (Node *) E; n->comment = G; A = (Node *) n; } commentStmt(A) ::= COMMENT ON DOMAIN_P typename(E) IS comment_text(G). { commentStmt *n = makeNode(commentStmt); n->objtype = OBJECT_DOMAIN; n->object = (Node *) E; n->comment = G; A = (Node *) n; } commentStmt(A) ::= COMMENT ON AGGREGATE aggregate_with_argtypes(E) IS comment_text(G). { commentStmt *n = makeNode(commentStmt); n->objtype = OBJECT_AGGREGATE; n->object = (Node *) E; n->comment = G; A = (Node *) n; } commentStmt(A) ::= COMMENT ON FUNCTION function_with_argtypes(E) IS comment_text(G). { commentStmt *n = makeNode(commentStmt); n->objtype = OBJECT_FUNCTION; n->object = (Node *) E; n->comment = G; A = (Node *) n; } commentStmt(A) ::= COMMENT ON OPERATOR operator_with_argtypes(E) IS comment_text(G). { commentStmt *n = makeNode(commentStmt); n->objtype = OBJECT_OPERATOR; n->object = (Node *) E; n->comment = G; A = (Node *) n; } commentStmt(A) ::= COMMENT ON CONSTRAINT name(E) ON any_name(G) IS comment_text(I). { commentStmt *n = makeNode(commentStmt); n->objtype = OBJECT_TABCONSTRAINT; n->object = (Node *) lappend(G, makeString(E)); n->comment = I; A = (Node *) n; } commentStmt(A) ::= COMMENT ON CONSTRAINT name(E) ON DOMAIN_P any_name(H) IS comment_text(J). { commentStmt *n = makeNode(commentStmt); n->objtype = OBJECT_DOMCONSTRAINT; n->object = (Node *) list_make2(makeTypeNameFromNameList(H), makeString(E)); n->comment = J; A = (Node *) n; } commentStmt(A) ::= COMMENT ON object_type_name_on_any_name(D) name(E) ON any_name(G) IS comment_text(I). { commentStmt *n = makeNode(commentStmt); n->objtype = D; n->object = (Node *) lappend(G, makeString(E)); n->comment = I; A = (Node *) n; } commentStmt(A) ::= COMMENT ON PROCEDURE function_with_argtypes(E) IS comment_text(G). { commentStmt *n = makeNode(commentStmt); n->objtype = OBJECT_PROCEDURE; n->object = (Node *) E; n->comment = G; A = (Node *) n; } commentStmt(A) ::= COMMENT ON ROUTINE function_with_argtypes(E) IS comment_text(G). { commentStmt *n = makeNode(commentStmt); n->objtype = OBJECT_ROUTINE; n->object = (Node *) E; n->comment = G; A = (Node *) n; } commentStmt(A) ::= COMMENT ON TRANSFORM FOR typename(F) LANGUAGE name(H) IS comment_text(J). { commentStmt *n = makeNode(commentStmt); n->objtype = OBJECT_TRANSFORM; n->object = (Node *) list_make2(F, makeString(H)); n->comment = J; A = (Node *) n; } commentStmt(A) ::= COMMENT ON OPERATOR CLASS any_name(F) USING name(H) IS comment_text(J). { commentStmt *n = makeNode(commentStmt); n->objtype = OBJECT_OPCLASS; n->object = (Node *) lcons(makeString(H), F); n->comment = J; A = (Node *) n; } commentStmt(A) ::= COMMENT ON OPERATOR FAMILY any_name(F) USING name(H) IS comment_text(J). { commentStmt *n = makeNode(commentStmt); n->objtype = OBJECT_OPFAMILY; n->object = (Node *) lcons(makeString(H), F); n->comment = J; A = (Node *) n; } commentStmt(A) ::= COMMENT ON LARGE_P OBJECT_P numericOnly(F) IS comment_text(H). { commentStmt *n = makeNode(commentStmt); n->objtype = OBJECT_LARGEOBJECT; n->object = (Node *) F; n->comment = H; A = (Node *) n; } commentStmt(A) ::= COMMENT ON CAST LPAREN typename(F) AS typename(H) RPAREN IS comment_text(K). { commentStmt *n = makeNode(commentStmt); n->objtype = OBJECT_CAST; n->object = (Node *) list_make2(F, H); n->comment = K; A = (Node *) n; } /* ----- comment_text ----- */ comment_text(A) ::= sconst(B). { A = B; } comment_text(A) ::= NULL_P. { A = NULL; } /* ----- secLabelStmt ----- */ secLabelStmt(A) ::= SECURITY LABEL opt_provider(D) ON object_type_any_name(F) any_name(G) IS security_label(I). { secLabelStmt *n = makeNode(secLabelStmt); n->provider = D; n->objtype = F; n->object = (Node *) G; n->label = I; A = (Node *) n; } secLabelStmt(A) ::= SECURITY LABEL opt_provider(D) ON COLUMN any_name(G) IS security_label(I). { secLabelStmt *n = makeNode(secLabelStmt); n->provider = D; n->objtype = OBJECT_COLUMN; n->object = (Node *) G; n->label = I; A = (Node *) n; } secLabelStmt(A) ::= SECURITY LABEL opt_provider(D) ON object_type_name(F) name(G) IS security_label(I). { secLabelStmt *n = makeNode(secLabelStmt); n->provider = D; n->objtype = F; n->object = (Node *) makeString(G); n->label = I; A = (Node *) n; } secLabelStmt(A) ::= SECURITY LABEL opt_provider(D) ON TYPE_P typename(G) IS security_label(I). { secLabelStmt *n = makeNode(secLabelStmt); n->provider = D; n->objtype = OBJECT_TYPE; n->object = (Node *) G; n->label = I; A = (Node *) n; } secLabelStmt(A) ::= SECURITY LABEL opt_provider(D) ON DOMAIN_P typename(G) IS security_label(I). { secLabelStmt *n = makeNode(secLabelStmt); n->provider = D; n->objtype = OBJECT_DOMAIN; n->object = (Node *) G; n->label = I; A = (Node *) n; } secLabelStmt(A) ::= SECURITY LABEL opt_provider(D) ON AGGREGATE aggregate_with_argtypes(G) IS security_label(I). { secLabelStmt *n = makeNode(secLabelStmt); n->provider = D; n->objtype = OBJECT_AGGREGATE; n->object = (Node *) G; n->label = I; A = (Node *) n; } secLabelStmt(A) ::= SECURITY LABEL opt_provider(D) ON FUNCTION function_with_argtypes(G) IS security_label(I). { secLabelStmt *n = makeNode(secLabelStmt); n->provider = D; n->objtype = OBJECT_FUNCTION; n->object = (Node *) G; n->label = I; A = (Node *) n; } secLabelStmt(A) ::= SECURITY LABEL opt_provider(D) ON LARGE_P OBJECT_P numericOnly(H) IS security_label(J). { secLabelStmt *n = makeNode(secLabelStmt); n->provider = D; n->objtype = OBJECT_LARGEOBJECT; n->object = (Node *) H; n->label = J; A = (Node *) n; } secLabelStmt(A) ::= SECURITY LABEL opt_provider(D) ON PROCEDURE function_with_argtypes(G) IS security_label(I). { secLabelStmt *n = makeNode(secLabelStmt); n->provider = D; n->objtype = OBJECT_PROCEDURE; n->object = (Node *) G; n->label = I; A = (Node *) n; } secLabelStmt(A) ::= SECURITY LABEL opt_provider(D) ON ROUTINE function_with_argtypes(G) IS security_label(I). { secLabelStmt *n = makeNode(secLabelStmt); n->provider = D; n->objtype = OBJECT_ROUTINE; n->object = (Node *) G; n->label = I; A = (Node *) n; } /* ----- opt_provider ----- */ opt_provider(A) ::= FOR nonReservedWord_or_Sconst(C). { A = C; } opt_provider(A) ::= . { A = NULL; } /* ----- security_label ----- */ security_label(A) ::= sconst(B). { A = B; } security_label(A) ::= NULL_P. { A = NULL; } /* ----- fetchStmt ----- */ fetchStmt(A) ::= FETCH fetch_args(C). { fetchStmt *n = (fetchStmt *) C; n->ismove = false; A = (Node *) n; } fetchStmt(A) ::= MOVE fetch_args(C). { fetchStmt *n = (fetchStmt *) C; n->ismove = true; A = (Node *) n; } /* ----- fetch_args ----- */ fetch_args(A) ::= cursor_name(B). { fetchStmt *n = makeNode(fetchStmt); n->portalname = B; n->direction = FETCH_FORWARD; n->howMany = 1; n->location = -1; n->direction_keyword = FETCH_KEYWORD_NONE; A = (Node *) n; } fetch_args(A) ::= from_in(B) cursor_name(C). { fetchStmt *n = makeNode(fetchStmt); n->portalname = C; n->direction = FETCH_FORWARD; n->howMany = 1; n->location = -1; n->direction_keyword = FETCH_KEYWORD_NONE; A = (Node *) n; } fetch_args(A) ::= signedIconst(B) opt_from_in(C) cursor_name(D). { fetchStmt *n = makeNode(fetchStmt); n->portalname = D; n->direction = FETCH_FORWARD; n->howMany = B; n->location = LOC(B); n->direction_keyword = FETCH_KEYWORD_NONE; A = (Node *) n; } fetch_args(A) ::= NEXT opt_from_in(C) cursor_name(D). { fetchStmt *n = makeNode(fetchStmt); n->portalname = D; n->direction = FETCH_FORWARD; n->howMany = 1; n->location = -1; n->direction_keyword = FETCH_KEYWORD_NEXT; A = (Node *) n; } fetch_args(A) ::= PRIOR opt_from_in(C) cursor_name(D). { fetchStmt *n = makeNode(fetchStmt); n->portalname = D; n->direction = FETCH_BACKWARD; n->howMany = 1; n->location = -1; n->direction_keyword = FETCH_KEYWORD_PRIOR; A = (Node *) n; } fetch_args(A) ::= FIRST_P opt_from_in(C) cursor_name(D). { fetchStmt *n = makeNode(fetchStmt); n->portalname = D; n->direction = FETCH_ABSOLUTE; n->howMany = 1; n->location = -1; n->direction_keyword = FETCH_KEYWORD_FIRST; A = (Node *) n; } fetch_args(A) ::= LAST_P opt_from_in(C) cursor_name(D). { fetchStmt *n = makeNode(fetchStmt); n->portalname = D; n->direction = FETCH_ABSOLUTE; n->howMany = -1; n->location = -1; n->direction_keyword = FETCH_KEYWORD_LAST; A = (Node *) n; } fetch_args(A) ::= ABSOLUTE_P signedIconst(C) opt_from_in(D) cursor_name(E). { fetchStmt *n = makeNode(fetchStmt); n->portalname = E; n->direction = FETCH_ABSOLUTE; n->howMany = C; n->location = LOC(C); n->direction_keyword = FETCH_KEYWORD_ABSOLUTE; A = (Node *) n; } fetch_args(A) ::= RELATIVE_P signedIconst(C) opt_from_in(D) cursor_name(E). { fetchStmt *n = makeNode(fetchStmt); n->portalname = E; n->direction = FETCH_RELATIVE; n->howMany = C; n->location = LOC(C); n->direction_keyword = FETCH_KEYWORD_RELATIVE; A = (Node *) n; } fetch_args(A) ::= ALL opt_from_in(C) cursor_name(D). { fetchStmt *n = makeNode(fetchStmt); n->portalname = D; n->direction = FETCH_FORWARD; n->howMany = FETCH_ALL; n->location = -1; n->direction_keyword = FETCH_KEYWORD_ALL; A = (Node *) n; } fetch_args(A) ::= FORWARD opt_from_in(C) cursor_name(D). { fetchStmt *n = makeNode(fetchStmt); n->portalname = D; n->direction = FETCH_FORWARD; n->howMany = 1; n->location = -1; n->direction_keyword = FETCH_KEYWORD_FORWARD; A = (Node *) n; } fetch_args(A) ::= FORWARD signedIconst(C) opt_from_in(D) cursor_name(E). { fetchStmt *n = makeNode(fetchStmt); n->portalname = E; n->direction = FETCH_FORWARD; n->howMany = C; n->location = LOC(C); n->direction_keyword = FETCH_KEYWORD_FORWARD; A = (Node *) n; } fetch_args(A) ::= FORWARD ALL opt_from_in(D) cursor_name(E). { fetchStmt *n = makeNode(fetchStmt); n->portalname = E; n->direction = FETCH_FORWARD; n->howMany = FETCH_ALL; n->location = -1; n->direction_keyword = FETCH_KEYWORD_FORWARD_ALL; A = (Node *) n; } fetch_args(A) ::= BACKWARD opt_from_in(C) cursor_name(D). { fetchStmt *n = makeNode(fetchStmt); n->portalname = D; n->direction = FETCH_BACKWARD; n->howMany = 1; n->location = -1; n->direction_keyword = FETCH_KEYWORD_BACKWARD; A = (Node *) n; } fetch_args(A) ::= BACKWARD signedIconst(C) opt_from_in(D) cursor_name(E). { fetchStmt *n = makeNode(fetchStmt); n->portalname = E; n->direction = FETCH_BACKWARD; n->howMany = C; n->location = LOC(C); n->direction_keyword = FETCH_KEYWORD_BACKWARD; A = (Node *) n; } fetch_args(A) ::= BACKWARD ALL opt_from_in(D) cursor_name(E). { fetchStmt *n = makeNode(fetchStmt); n->portalname = E; n->direction = FETCH_BACKWARD; n->howMany = FETCH_ALL; n->location = -1; n->direction_keyword = FETCH_KEYWORD_BACKWARD_ALL; A = (Node *) n; } /* ----- from_in ----- */ from_in(A) ::= FROM. from_in(A) ::= IN_P. /* ----- opt_from_in ----- */ opt_from_in(A) ::= from_in(B). /* ----- grantStmt ----- */ grantStmt(A) ::= GRANT privileges(C) ON privilege_target(E) TO grantee_list(G) opt_grant_grant_option(H) opt_granted_by(I). { grantStmt *n = makeNode(grantStmt); n->is_grant = true; n->privileges = C; n->targtype = (E)->targtype; n->objtype = (E)->objtype; n->objects = (E)->objs; n->grantees = G; n->grant_option = H; n->grantor = I; A = (Node *) n; } /* ----- revokeStmt ----- */ revokeStmt(A) ::= REVOKE privileges(C) ON privilege_target(E) FROM grantee_list(G) opt_granted_by(H) opt_drop_behavior(I). { grantStmt *n = makeNode(grantStmt); n->is_grant = false; n->grant_option = false; n->privileges = C; n->targtype = (E)->targtype; n->objtype = (E)->objtype; n->objects = (E)->objs; n->grantees = G; n->grantor = H; n->behavior = I; A = (Node *) n; } revokeStmt(A) ::= REVOKE GRANT OPTION FOR privileges(F) ON privilege_target(H) FROM grantee_list(J) opt_granted_by(K) opt_drop_behavior(L). { grantStmt *n = makeNode(grantStmt); n->is_grant = false; n->grant_option = true; n->privileges = F; n->targtype = (H)->targtype; n->objtype = (H)->objtype; n->objects = (H)->objs; n->grantees = J; n->grantor = K; n->behavior = L; A = (Node *) n; } /* ----- privileges ----- */ privileges(A) ::= privilege_list(B). { A = B; } privileges(A) ::= ALL. { A = NIL; } privileges(A) ::= ALL PRIVILEGES. { A = NIL; } privileges(A) ::= ALL LPAREN columnList(D) RPAREN. { AccessPriv *n = makeNode(AccessPriv); n->priv_name = NULL; n->cols = D; A = list_make1(n); } privileges(A) ::= ALL PRIVILEGES LPAREN columnList(E) RPAREN. { AccessPriv *n = makeNode(AccessPriv); n->priv_name = NULL; n->cols = E; A = list_make1(n); } /* ----- privilege_list ----- */ privilege_list(A) ::= privilege(B). { A = list_make1(B); } privilege_list(A) ::= privilege_list(B) COMMA privilege(D). { A = lappend(B, D); } /* ----- privilege ----- */ privilege(A) ::= SELECT opt_column_list(C). { AccessPriv *n = makeNode(AccessPriv); n->priv_name = pstrdup(B); n->cols = C; A = n; } privilege(A) ::= REFERENCES opt_column_list(C). { AccessPriv *n = makeNode(AccessPriv); n->priv_name = pstrdup(B); n->cols = C; A = n; } privilege(A) ::= CREATE opt_column_list(C). { AccessPriv *n = makeNode(AccessPriv); n->priv_name = pstrdup(B); n->cols = C; A = n; } privilege(A) ::= ALTER SYSTEM_P. { AccessPriv *n = makeNode(AccessPriv); n->priv_name = pstrdup("alter system"); n->cols = NIL; A = n; } privilege(A) ::= colId(B) opt_column_list(C). { AccessPriv *n = makeNode(AccessPriv); n->priv_name = B; n->cols = C; A = n; } /* ----- parameter_name_list ----- */ parameter_name_list(A) ::= parameter_name(B). { A = list_make1(makeString(B)); } parameter_name_list(A) ::= parameter_name_list(B) COMMA parameter_name(D). { A = lappend(B, makeString(D)); } /* ----- parameter_name ----- */ parameter_name(A) ::= colId(B). { A = B; } parameter_name(A) ::= parameter_name(B) DOT colId(D). { A = psprintf("%s.%s", B, D); } /* ----- privilege_target ----- */ privilege_target(A) ::= qualified_name_list(B). { PrivTarget *n = palloc_object(PrivTarget); n->targtype = ACL_TARGET_OBJECT; n->objtype = OBJECT_TABLE; n->objs = B; A = n; } privilege_target(A) ::= TABLE qualified_name_list(C). { PrivTarget *n = palloc_object(PrivTarget); n->targtype = ACL_TARGET_OBJECT; n->objtype = OBJECT_TABLE; n->objs = C; A = n; } privilege_target(A) ::= SEQUENCE qualified_name_list(C). { PrivTarget *n = palloc_object(PrivTarget); n->targtype = ACL_TARGET_OBJECT; n->objtype = OBJECT_SEQUENCE; n->objs = C; A = n; } privilege_target(A) ::= FOREIGN DATA_P WRAPPER name_list(E). { PrivTarget *n = palloc_object(PrivTarget); n->targtype = ACL_TARGET_OBJECT; n->objtype = OBJECT_FDW; n->objs = E; A = n; } privilege_target(A) ::= FOREIGN SERVER name_list(D). { PrivTarget *n = palloc_object(PrivTarget); n->targtype = ACL_TARGET_OBJECT; n->objtype = OBJECT_FOREIGN_SERVER; n->objs = D; A = n; } privilege_target(A) ::= FUNCTION function_with_argtypes_list(C). { PrivTarget *n = palloc_object(PrivTarget); n->targtype = ACL_TARGET_OBJECT; n->objtype = OBJECT_FUNCTION; n->objs = C; A = n; } privilege_target(A) ::= PROCEDURE function_with_argtypes_list(C). { PrivTarget *n = palloc_object(PrivTarget); n->targtype = ACL_TARGET_OBJECT; n->objtype = OBJECT_PROCEDURE; n->objs = C; A = n; } privilege_target(A) ::= ROUTINE function_with_argtypes_list(C). { PrivTarget *n = palloc_object(PrivTarget); n->targtype = ACL_TARGET_OBJECT; n->objtype = OBJECT_ROUTINE; n->objs = C; A = n; } privilege_target(A) ::= DATABASE name_list(C). { PrivTarget *n = palloc_object(PrivTarget); n->targtype = ACL_TARGET_OBJECT; n->objtype = OBJECT_DATABASE; n->objs = C; A = n; } privilege_target(A) ::= DOMAIN_P any_name_list(C). { PrivTarget *n = palloc_object(PrivTarget); n->targtype = ACL_TARGET_OBJECT; n->objtype = OBJECT_DOMAIN; n->objs = C; A = n; } privilege_target(A) ::= LANGUAGE name_list(C). { PrivTarget *n = palloc_object(PrivTarget); n->targtype = ACL_TARGET_OBJECT; n->objtype = OBJECT_LANGUAGE; n->objs = C; A = n; } privilege_target(A) ::= LARGE_P OBJECT_P numericOnly_list(D). { PrivTarget *n = palloc_object(PrivTarget); n->targtype = ACL_TARGET_OBJECT; n->objtype = OBJECT_LARGEOBJECT; n->objs = D; A = n; } privilege_target(A) ::= PARAMETER parameter_name_list(C). { PrivTarget *n = palloc_object(PrivTarget); n->targtype = ACL_TARGET_OBJECT; n->objtype = OBJECT_PARAMETER_ACL; n->objs = C; A = n; } privilege_target(A) ::= PROPERTY GRAPH qualified_name_list(D). { PrivTarget *n = palloc_object(PrivTarget); n->targtype = ACL_TARGET_OBJECT; n->objtype = OBJECT_PROPGRAPH; n->objs = D; A = n; } privilege_target(A) ::= SCHEMA name_list(C). { PrivTarget *n = palloc_object(PrivTarget); n->targtype = ACL_TARGET_OBJECT; n->objtype = OBJECT_SCHEMA; n->objs = C; A = n; } privilege_target(A) ::= TABLESPACE name_list(C). { PrivTarget *n = palloc_object(PrivTarget); n->targtype = ACL_TARGET_OBJECT; n->objtype = OBJECT_TABLESPACE; n->objs = C; A = n; } privilege_target(A) ::= TYPE_P any_name_list(C). { PrivTarget *n = palloc_object(PrivTarget); n->targtype = ACL_TARGET_OBJECT; n->objtype = OBJECT_TYPE; n->objs = C; A = n; } privilege_target(A) ::= ALL TABLES IN_P SCHEMA name_list(F). { PrivTarget *n = palloc_object(PrivTarget); n->targtype = ACL_TARGET_ALL_IN_SCHEMA; n->objtype = OBJECT_TABLE; n->objs = F; A = n; } privilege_target(A) ::= ALL SEQUENCES IN_P SCHEMA name_list(F). { PrivTarget *n = palloc_object(PrivTarget); n->targtype = ACL_TARGET_ALL_IN_SCHEMA; n->objtype = OBJECT_SEQUENCE; n->objs = F; A = n; } privilege_target(A) ::= ALL FUNCTIONS IN_P SCHEMA name_list(F). { PrivTarget *n = palloc_object(PrivTarget); n->targtype = ACL_TARGET_ALL_IN_SCHEMA; n->objtype = OBJECT_FUNCTION; n->objs = F; A = n; } privilege_target(A) ::= ALL PROCEDURES IN_P SCHEMA name_list(F). { PrivTarget *n = palloc_object(PrivTarget); n->targtype = ACL_TARGET_ALL_IN_SCHEMA; n->objtype = OBJECT_PROCEDURE; n->objs = F; A = n; } privilege_target(A) ::= ALL ROUTINES IN_P SCHEMA name_list(F). { PrivTarget *n = palloc_object(PrivTarget); n->targtype = ACL_TARGET_ALL_IN_SCHEMA; n->objtype = OBJECT_ROUTINE; n->objs = F; A = n; } /* ----- grantee_list ----- */ grantee_list(A) ::= grantee(B). { A = list_make1(B); } grantee_list(A) ::= grantee_list(B) COMMA grantee(D). { A = lappend(B, D); } /* ----- grantee ----- */ grantee(A) ::= roleSpec(B). { A = B; } grantee(A) ::= GROUP_P roleSpec(C). { A = C; } /* ----- opt_grant_grant_option ----- */ opt_grant_grant_option(A) ::= WITH GRANT OPTION. { A = true; } opt_grant_grant_option(A) ::= . { A = false; } /* ----- grantRoleStmt ----- */ grantRoleStmt(A) ::= GRANT privilege_list(C) TO role_list(E) opt_granted_by(F). { grantRoleStmt *n = makeNode(grantRoleStmt); n->is_grant = true; n->granted_roles = C; n->grantee_roles = E; n->opt = NIL; n->grantor = F; A = (Node *) n; } grantRoleStmt(A) ::= GRANT privilege_list(C) TO role_list(E) WITH grant_role_opt_list(G) opt_granted_by(H). { grantRoleStmt *n = makeNode(grantRoleStmt); n->is_grant = true; n->granted_roles = C; n->grantee_roles = E; n->opt = G; n->grantor = H; A = (Node *) n; } /* ----- revokeRoleStmt ----- */ revokeRoleStmt(A) ::= REVOKE privilege_list(C) FROM role_list(E) opt_granted_by(F) opt_drop_behavior(G). { grantRoleStmt *n = makeNode(grantRoleStmt); n->is_grant = false; n->opt = NIL; n->granted_roles = C; n->grantee_roles = E; n->grantor = F; n->behavior = G; A = (Node *) n; } revokeRoleStmt(A) ::= REVOKE colId(C) OPTION FOR privilege_list(F) FROM role_list(H) opt_granted_by(I) opt_drop_behavior(J). { grantRoleStmt *n = makeNode(grantRoleStmt); DefElem *opt; opt = makeDefElem(pstrdup(C), (Node *) makeBoolean(false), LOC(C)); n->is_grant = false; n->opt = list_make1(opt); n->granted_roles = F; n->grantee_roles = H; n->grantor = I; n->behavior = J; A = (Node *) n; } /* ----- grant_role_opt_list ----- */ grant_role_opt_list(A) ::= grant_role_opt_list(B) COMMA grant_role_opt(D). { A = lappend(B, D); } grant_role_opt_list(A) ::= grant_role_opt(B). { A = list_make1(B); } /* ----- grant_role_opt ----- */ grant_role_opt(A) ::= colLabel(B) grant_role_opt_value(C). { A = makeDefElem(pstrdup(B), C, LOC(B)); } /* ----- grant_role_opt_value ----- */ grant_role_opt_value(A) ::= OPTION. { A = (Node *) makeBoolean(true); } grant_role_opt_value(A) ::= TRUE_P. { A = (Node *) makeBoolean(true); } grant_role_opt_value(A) ::= FALSE_P. { A = (Node *) makeBoolean(false); } /* ----- opt_granted_by ----- */ opt_granted_by(A) ::= GRANTED BY roleSpec(D). { A = D; } opt_granted_by(A) ::= . { A = NULL; } /* ----- alterDefaultPrivilegesStmt ----- */ alterDefaultPrivilegesStmt(A) ::= ALTER DEFAULT PRIVILEGES defACLOptionList(E) defACLAction(F). { alterDefaultPrivilegesStmt *n = makeNode(alterDefaultPrivilegesStmt); n->options = E; n->action = (grantStmt *) F; A = (Node *) n; } /* ----- defACLOptionList ----- */ defACLOptionList(A) ::= defACLOptionList(B) defACLOption(C). { A = lappend(B, C); } defACLOptionList(A) ::= . { A = NIL; } /* ----- defACLOption ----- */ defACLOption(A) ::= IN_P SCHEMA name_list(D). { A = makeDefElem("schemas", (Node *) D, LOC(B)); } defACLOption(A) ::= FOR ROLE role_list(D). { A = makeDefElem("roles", (Node *) D, LOC(B)); } defACLOption(A) ::= FOR USER role_list(D). { A = makeDefElem("roles", (Node *) D, LOC(B)); } /* ----- defACLAction ----- */ defACLAction(A) ::= GRANT privileges(C) ON defacl_privilege_target(E) TO grantee_list(G) opt_grant_grant_option(H). { grantStmt *n = makeNode(grantStmt); n->is_grant = true; n->privileges = C; n->targtype = ACL_TARGET_DEFAULTS; n->objtype = E; n->objects = NIL; n->grantees = G; n->grant_option = H; A = (Node *) n; } defACLAction(A) ::= REVOKE privileges(C) ON defacl_privilege_target(E) FROM grantee_list(G) opt_drop_behavior(H). { grantStmt *n = makeNode(grantStmt); n->is_grant = false; n->grant_option = false; n->privileges = C; n->targtype = ACL_TARGET_DEFAULTS; n->objtype = E; n->objects = NIL; n->grantees = G; n->behavior = H; A = (Node *) n; } defACLAction(A) ::= REVOKE GRANT OPTION FOR privileges(F) ON defacl_privilege_target(H) FROM grantee_list(J) opt_drop_behavior(K). { grantStmt *n = makeNode(grantStmt); n->is_grant = false; n->grant_option = true; n->privileges = F; n->targtype = ACL_TARGET_DEFAULTS; n->objtype = H; n->objects = NIL; n->grantees = J; n->behavior = K; A = (Node *) n; } /* ----- defacl_privilege_target ----- */ defacl_privilege_target(A) ::= TABLES. { A = OBJECT_TABLE; } defacl_privilege_target(A) ::= FUNCTIONS. { A = OBJECT_FUNCTION; } defacl_privilege_target(A) ::= ROUTINES. { A = OBJECT_FUNCTION; } defacl_privilege_target(A) ::= SEQUENCES. { A = OBJECT_SEQUENCE; } defacl_privilege_target(A) ::= TYPES_P. { A = OBJECT_TYPE; } defacl_privilege_target(A) ::= SCHEMAS. { A = OBJECT_SCHEMA; } defacl_privilege_target(A) ::= LARGE_P OBJECTS_P. { A = OBJECT_LARGEOBJECT; } /* ----- indexStmt ----- */ indexStmt(A) ::= CREATE opt_unique(C) INDEX opt_concurrently(E) opt_single_name(F) ON relation_expr(H) access_method_clause(I) LPAREN index_params(K) RPAREN opt_include(M) opt_unique_null_treatment(N) opt_reloptions(O) optTableSpace(P) where_clause(Q). { indexStmt *n = makeNode(indexStmt); n->unique = C; n->concurrent = E; n->idxname = F; n->relation = H; n->accessMethod = I; n->indexParams = K; n->indexIncludingParams = M; n->nulls_not_distinct = !N; n->options = O; n->tableSpace = P; n->whereClause = Q; n->excludeOpNames = NIL; n->idxcomment = NULL; n->indexOid = InvalidOid; n->oldNumber = InvalidRelFileNumber; n->oldCreateSubid = InvalidSubTransactionId; n->oldFirstRelfilelocatorSubid = InvalidSubTransactionId; n->primary = false; n->isconstraint = false; n->deferrable = false; n->initdeferred = false; n->transformed = false; n->if_not_exists = false; n->reset_default_tblspc = false; A = (Node *) n; } indexStmt(A) ::= CREATE opt_unique(C) INDEX opt_concurrently(E) IF_P NOT EXISTS name(I) ON relation_expr(K) access_method_clause(L) LPAREN index_params(N) RPAREN opt_include(P) opt_unique_null_treatment(Q) opt_reloptions(R) optTableSpace(S) where_clause(T). { indexStmt *n = makeNode(indexStmt); n->unique = C; n->concurrent = E; n->idxname = I; n->relation = K; n->accessMethod = L; n->indexParams = N; n->indexIncludingParams = P; n->nulls_not_distinct = !Q; n->options = R; n->tableSpace = S; n->whereClause = T; n->excludeOpNames = NIL; n->idxcomment = NULL; n->indexOid = InvalidOid; n->oldNumber = InvalidRelFileNumber; n->oldCreateSubid = InvalidSubTransactionId; n->oldFirstRelfilelocatorSubid = InvalidSubTransactionId; n->primary = false; n->isconstraint = false; n->deferrable = false; n->initdeferred = false; n->transformed = false; n->if_not_exists = true; n->reset_default_tblspc = false; A = (Node *) n; } /* ----- opt_unique ----- */ opt_unique(A) ::= UNIQUE. { A = true; } opt_unique(A) ::= . { A = false; } /* ----- access_method_clause ----- */ access_method_clause(A) ::= USING name(C). { A = C; } access_method_clause(A) ::= . { A = DEFAULT_INDEX_TYPE; } /* ----- index_params ----- */ index_params(A) ::= index_elem(B). { A = list_make1(B); } index_params(A) ::= index_params(B) COMMA index_elem(D). { A = lappend(B, D); } /* ----- index_elem_options ----- */ index_elem_options(A) ::= opt_collate(B) opt_qualified_name(C) opt_asc_desc(D) opt_nulls_order(E). { A = makeNode(IndexElem); A->name = NULL; A->expr = NULL; A->indexcolname = NULL; A->collation = B; A->opclass = C; A->opclassopts = NIL; A->ordering = D; A->nulls_ordering = E; } index_elem_options(A) ::= opt_collate(B) any_name(C) reloptions(D) opt_asc_desc(E) opt_nulls_order(F). { A = makeNode(IndexElem); A->name = NULL; A->expr = NULL; A->indexcolname = NULL; A->collation = B; A->opclass = C; A->opclassopts = D; A->ordering = E; A->nulls_ordering = F; } /* ----- index_elem ----- */ index_elem(A) ::= colId(B) index_elem_options(C). { A = C; A->name = B; A->location = LOC(B); } index_elem(A) ::= func_expr_windowless(B) index_elem_options(C). { A = C; A->expr = B; A->location = LOC(B); } index_elem(A) ::= LPAREN a_expr(C) RPAREN index_elem_options(E). { A = E; A->expr = C; A->location = LOC(B); } /* ----- opt_include ----- */ opt_include(A) ::= INCLUDE LPAREN index_including_params(D) RPAREN. { A = D; } opt_include(A) ::= . { A = NIL; } /* ----- index_including_params ----- */ index_including_params(A) ::= index_elem(B). { A = list_make1(B); } index_including_params(A) ::= index_including_params(B) COMMA index_elem(D). { A = lappend(B, D); } /* ----- opt_collate ----- */ opt_collate(A) ::= COLLATE any_name(C). { A = C; } opt_collate(A) ::= . { A = NIL; } /* ----- opt_asc_desc ----- */ opt_asc_desc(A) ::= ASC. { A = SORTBY_ASC; } opt_asc_desc(A) ::= DESC. { A = SORTBY_DESC; } opt_asc_desc(A) ::= . { A = SORTBY_DEFAULT; } /* ----- opt_nulls_order ----- */ opt_nulls_order(A) ::= NULLS_LA FIRST_P. { A = SORTBY_NULLS_FIRST; } opt_nulls_order(A) ::= NULLS_LA LAST_P. { A = SORTBY_NULLS_LAST; } opt_nulls_order(A) ::= . { A = SORTBY_NULLS_DEFAULT; } /* ----- createFunctionStmt ----- */ createFunctionStmt(A) ::= CREATE opt_or_replace(C) FUNCTION func_name(E) func_args_with_defaults(F) RETURNS func_return(H) opt_createfunc_opt_list(I) opt_routine_body(J). { createFunctionStmt *n = makeNode(createFunctionStmt); n->is_procedure = false; n->replace = C; n->funcname = E; n->parameters = F; n->returnType = H; n->options = I; n->sql_body = J; A = (Node *) n; } createFunctionStmt(A) ::= CREATE opt_or_replace(C) FUNCTION func_name(E) func_args_with_defaults(F) RETURNS TABLE LPAREN table_func_column_list(J) RPAREN opt_createfunc_opt_list(L) opt_routine_body(M). { createFunctionStmt *n = makeNode(createFunctionStmt); n->is_procedure = false; n->replace = C; n->funcname = E; n->parameters = mergeTableFuncParameters(F, J, yyscanner); n->returnType = TableFuncTypeName(J); n->returnType->location = LOC(H); n->options = L; n->sql_body = M; A = (Node *) n; } createFunctionStmt(A) ::= CREATE opt_or_replace(C) FUNCTION func_name(E) func_args_with_defaults(F) opt_createfunc_opt_list(G) opt_routine_body(H). { createFunctionStmt *n = makeNode(createFunctionStmt); n->is_procedure = false; n->replace = C; n->funcname = E; n->parameters = F; n->returnType = NULL; n->options = G; n->sql_body = H; A = (Node *) n; } createFunctionStmt(A) ::= CREATE opt_or_replace(C) PROCEDURE func_name(E) func_args_with_defaults(F) opt_createfunc_opt_list(G) opt_routine_body(H). { createFunctionStmt *n = makeNode(createFunctionStmt); n->is_procedure = true; n->replace = C; n->funcname = E; n->parameters = F; n->returnType = NULL; n->options = G; n->sql_body = H; A = (Node *) n; } /* ----- opt_or_replace ----- */ opt_or_replace(A) ::= OR REPLACE. { A = true; } opt_or_replace(A) ::= . { A = false; } /* ----- func_args ----- */ func_args(A) ::= LPAREN func_args_list(C) RPAREN. { A = C; } func_args(A) ::= LPAREN RPAREN. { A = NIL; } /* ----- func_args_list ----- */ func_args_list(A) ::= func_arg(B). { A = list_make1(B); } func_args_list(A) ::= func_args_list(B) COMMA func_arg(D). { A = lappend(B, D); } /* ----- function_with_argtypes_list ----- */ function_with_argtypes_list(A) ::= function_with_argtypes(B). { A = list_make1(B); } function_with_argtypes_list(A) ::= function_with_argtypes_list(B) COMMA function_with_argtypes(D). { A = lappend(B, D); } /* ----- function_with_argtypes ----- */ function_with_argtypes(A) ::= func_name(B) func_args(C). { ObjectWithArgs *n = makeNode(ObjectWithArgs); n->objname = B; n->objargs = extractArgTypes(C); n->objfuncargs = C; A = n; } function_with_argtypes(A) ::= type_func_name_keyword(B). { ObjectWithArgs *n = makeNode(ObjectWithArgs); n->objname = list_make1(makeString(pstrdup(B))); n->args_unspecified = true; A = n; } function_with_argtypes(A) ::= colId(B). { ObjectWithArgs *n = makeNode(ObjectWithArgs); n->objname = list_make1(makeString(B)); n->args_unspecified = true; A = n; } function_with_argtypes(A) ::= colId(B) indirection(C). { ObjectWithArgs *n = makeNode(ObjectWithArgs); n->objname = check_func_name(lcons(makeString(B), C), yyscanner); n->args_unspecified = true; A = n; } /* ----- func_args_with_defaults ----- */ func_args_with_defaults(A) ::= LPAREN func_args_with_defaults_list(C) RPAREN. { A = C; } func_args_with_defaults(A) ::= LPAREN RPAREN. { A = NIL; } /* ----- func_args_with_defaults_list ----- */ func_args_with_defaults_list(A) ::= func_arg_with_default(B). { A = list_make1(B); } func_args_with_defaults_list(A) ::= func_args_with_defaults_list(B) COMMA func_arg_with_default(D). { A = lappend(B, D); } /* ----- func_arg ----- */ func_arg(A) ::= arg_class(B) param_name(C) func_type(D). { FunctionParameter *n = makeNode(FunctionParameter); n->name = C; n->argType = D; n->mode = B; n->defexpr = NULL; n->location = LOC(B); A = n; } func_arg(A) ::= param_name(B) arg_class(C) func_type(D). { FunctionParameter *n = makeNode(FunctionParameter); n->name = B; n->argType = D; n->mode = C; n->defexpr = NULL; n->location = LOC(B); A = n; } func_arg(A) ::= param_name(B) func_type(C). { FunctionParameter *n = makeNode(FunctionParameter); n->name = B; n->argType = C; n->mode = FUNC_PARAM_DEFAULT; n->defexpr = NULL; n->location = LOC(B); A = n; } func_arg(A) ::= arg_class(B) func_type(C). { FunctionParameter *n = makeNode(FunctionParameter); n->name = NULL; n->argType = C; n->mode = B; n->defexpr = NULL; n->location = LOC(B); A = n; } func_arg(A) ::= func_type(B). { FunctionParameter *n = makeNode(FunctionParameter); n->name = NULL; n->argType = B; n->mode = FUNC_PARAM_DEFAULT; n->defexpr = NULL; n->location = LOC(B); A = n; } /* ----- arg_class ----- */ arg_class(A) ::= IN_P. { A = FUNC_PARAM_IN; } arg_class(A) ::= OUT_P. { A = FUNC_PARAM_OUT; } arg_class(A) ::= INOUT. { A = FUNC_PARAM_INOUT; } arg_class(A) ::= IN_P OUT_P. { A = FUNC_PARAM_INOUT; } arg_class(A) ::= VARIADIC. { A = FUNC_PARAM_VARIADIC; } /* ----- param_name ----- */ param_name(A) ::= type_function_name(B). /* ----- func_return ----- */ func_return(A) ::= func_type(B). { A = B; } /* ----- func_type ----- */ func_type(A) ::= typename(B). { A = B; } func_type(A) ::= type_function_name(B) attrs(C) PERCENT TYPE_P. { A = makeTypeNameFromNameList(lcons(makeString(B), C)); A->pct_type = true; A->location = LOC(B); } func_type(A) ::= SETOF type_function_name(C) attrs(D) PERCENT TYPE_P. { A = makeTypeNameFromNameList(lcons(makeString(C), D)); A->pct_type = true; A->setof = true; A->location = LOC(C); } /* ----- func_arg_with_default ----- */ func_arg_with_default(A) ::= func_arg(B). { A = B; } func_arg_with_default(A) ::= func_arg(B) DEFAULT a_expr(D). { A = B; A->defexpr = D; } func_arg_with_default(A) ::= func_arg(B) EQ a_expr(D). { A = B; A->defexpr = D; } /* ----- aggr_arg ----- */ aggr_arg(A) ::= func_arg(B). { if (!(B->mode == FUNC_PARAM_DEFAULT || B->mode == FUNC_PARAM_IN || B->mode == FUNC_PARAM_VARIADIC)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("aggregates cannot have output arguments"), parser_errposition(LOC(B)))); A = B; } /* ----- aggr_args ----- */ aggr_args(A) ::= LPAREN STAR RPAREN. { A = list_make2(NIL, makeInteger(-1)); } aggr_args(A) ::= LPAREN aggr_args_list(C) RPAREN. { A = list_make2(C, makeInteger(-1)); } aggr_args(A) ::= LPAREN ORDER BY aggr_args_list(E) RPAREN. { A = list_make2(E, makeInteger(0)); } aggr_args(A) ::= LPAREN aggr_args_list(C) ORDER BY aggr_args_list(F) RPAREN. { A = makeOrderedSetArgs(C, F, yyscanner); } /* ----- aggr_args_list ----- */ aggr_args_list(A) ::= aggr_arg(B). { A = list_make1(B); } aggr_args_list(A) ::= aggr_args_list(B) COMMA aggr_arg(D). { A = lappend(B, D); } /* ----- aggregate_with_argtypes ----- */ aggregate_with_argtypes(A) ::= func_name(B) aggr_args(C). { ObjectWithArgs *n = makeNode(ObjectWithArgs); n->objname = B; n->objargs = extractAggrArgTypes(C); n->objfuncargs = (List *) linitial(C); A = n; } /* ----- aggregate_with_argtypes_list ----- */ aggregate_with_argtypes_list(A) ::= aggregate_with_argtypes(B). { A = list_make1(B); } aggregate_with_argtypes_list(A) ::= aggregate_with_argtypes_list(B) COMMA aggregate_with_argtypes(D). { A = lappend(B, D); } /* ----- opt_createfunc_opt_list ----- */ opt_createfunc_opt_list(A) ::= createfunc_opt_list(B). opt_createfunc_opt_list(A) ::= . { A = NIL; } /* ----- createfunc_opt_list ----- */ createfunc_opt_list(A) ::= createfunc_opt_item(B). { A = list_make1(B); } createfunc_opt_list(A) ::= createfunc_opt_list(B) createfunc_opt_item(C). { A = lappend(B, C); } /* ----- common_func_opt_item ----- */ common_func_opt_item(A) ::= CALLED ON NULL_P INPUT_P. { A = makeDefElem("strict", (Node *) makeBoolean(false), LOC(B)); } common_func_opt_item(A) ::= RETURNS NULL_P ON NULL_P INPUT_P. { A = makeDefElem("strict", (Node *) makeBoolean(true), LOC(B)); } common_func_opt_item(A) ::= STRICT_P. { A = makeDefElem("strict", (Node *) makeBoolean(true), LOC(B)); } common_func_opt_item(A) ::= IMMUTABLE. { A = makeDefElem("volatility", (Node *) makeString("immutable"), LOC(B)); } common_func_opt_item(A) ::= STABLE. { A = makeDefElem("volatility", (Node *) makeString("stable"), LOC(B)); } common_func_opt_item(A) ::= VOLATILE. { A = makeDefElem("volatility", (Node *) makeString("volatile"), LOC(B)); } common_func_opt_item(A) ::= EXTERNAL SECURITY DEFINER. { A = makeDefElem("security", (Node *) makeBoolean(true), LOC(B)); } common_func_opt_item(A) ::= EXTERNAL SECURITY INVOKER. { A = makeDefElem("security", (Node *) makeBoolean(false), LOC(B)); } common_func_opt_item(A) ::= SECURITY DEFINER. { A = makeDefElem("security", (Node *) makeBoolean(true), LOC(B)); } common_func_opt_item(A) ::= SECURITY INVOKER. { A = makeDefElem("security", (Node *) makeBoolean(false), LOC(B)); } common_func_opt_item(A) ::= LEAKPROOF. { A = makeDefElem("leakproof", (Node *) makeBoolean(true), LOC(B)); } common_func_opt_item(A) ::= NOT LEAKPROOF. { A = makeDefElem("leakproof", (Node *) makeBoolean(false), LOC(B)); } common_func_opt_item(A) ::= COST numericOnly(C). { A = makeDefElem("cost", (Node *) C, LOC(B)); } common_func_opt_item(A) ::= ROWS numericOnly(C). { A = makeDefElem("rows", (Node *) C, LOC(B)); } common_func_opt_item(A) ::= SUPPORT any_name(C). { A = makeDefElem("support", (Node *) C, LOC(B)); } common_func_opt_item(A) ::= functionSetResetClause(B). { A = makeDefElem("set", (Node *) B, LOC(B)); } common_func_opt_item(A) ::= PARALLEL colId(C). { A = makeDefElem("parallel", (Node *) makeString(C), LOC(B)); } /* ----- createfunc_opt_item ----- */ createfunc_opt_item(A) ::= AS func_as(C). { A = makeDefElem("as", (Node *) C, LOC(B)); } createfunc_opt_item(A) ::= LANGUAGE nonReservedWord_or_Sconst(C). { A = makeDefElem("language", (Node *) makeString(C), LOC(B)); } createfunc_opt_item(A) ::= TRANSFORM transform_type_list(C). { A = makeDefElem("transform", (Node *) C, LOC(B)); } createfunc_opt_item(A) ::= WINDOW. { A = makeDefElem("window", (Node *) makeBoolean(true), LOC(B)); } createfunc_opt_item(A) ::= common_func_opt_item(B). { A = B; } /* ----- func_as ----- */ func_as(A) ::= sconst(B). { A = list_make1(makeString(B)); } func_as(A) ::= sconst(B) COMMA sconst(D). { A = list_make2(makeString(B), makeString(D)); } /* ----- returnStmt ----- */ returnStmt(A) ::= RETURN a_expr(C). { returnStmt *r = makeNode(returnStmt); r->returnval = (Node *) C; A = (Node *) r; } /* ----- opt_routine_body ----- */ opt_routine_body(A) ::= returnStmt(B). { A = B; } opt_routine_body(A) ::= BEGIN_P ATOMIC routine_body_stmt_list(D) END_P. { A = (Node *) list_make1(D); } opt_routine_body(A) ::= . { A = NULL; } /* ----- routine_body_stmt_list ----- */ routine_body_stmt_list(A) ::= routine_body_stmt_list(B) routine_body_stmt(C) SEMICOLON. { if (C != NULL) A = lappend(B, C); else A = B; } routine_body_stmt_list(A) ::= . { A = NIL; } /* ----- routine_body_stmt ----- */ routine_body_stmt(A) ::= stmt(B). routine_body_stmt(A) ::= returnStmt(B). /* ----- transform_type_list ----- */ transform_type_list(A) ::= FOR TYPE_P typename(D). { A = list_make1(D); } transform_type_list(A) ::= transform_type_list(B) COMMA FOR TYPE_P typename(F). { A = lappend(B, F); } /* ----- opt_definition ----- */ opt_definition(A) ::= WITH definition(C). { A = C; } opt_definition(A) ::= . { A = NIL; } /* ----- table_func_column ----- */ table_func_column(A) ::= param_name(B) func_type(C). { FunctionParameter *n = makeNode(FunctionParameter); n->name = B; n->argType = C; n->mode = FUNC_PARAM_TABLE; n->defexpr = NULL; n->location = LOC(B); A = n; } /* ----- table_func_column_list ----- */ table_func_column_list(A) ::= table_func_column(B). { A = list_make1(B); } table_func_column_list(A) ::= table_func_column_list(B) COMMA table_func_column(D). { A = lappend(B, D); } /* ----- alterFunctionStmt ----- */ alterFunctionStmt(A) ::= ALTER FUNCTION function_with_argtypes(D) alterfunc_opt_list(E) opt_restrict(F). { alterFunctionStmt *n = makeNode(alterFunctionStmt); n->objtype = OBJECT_FUNCTION; n->func = D; n->actions = E; A = (Node *) n; } alterFunctionStmt(A) ::= ALTER PROCEDURE function_with_argtypes(D) alterfunc_opt_list(E) opt_restrict(F). { alterFunctionStmt *n = makeNode(alterFunctionStmt); n->objtype = OBJECT_PROCEDURE; n->func = D; n->actions = E; A = (Node *) n; } alterFunctionStmt(A) ::= ALTER ROUTINE function_with_argtypes(D) alterfunc_opt_list(E) opt_restrict(F). { alterFunctionStmt *n = makeNode(alterFunctionStmt); n->objtype = OBJECT_ROUTINE; n->func = D; n->actions = E; A = (Node *) n; } /* ----- alterfunc_opt_list ----- */ alterfunc_opt_list(A) ::= common_func_opt_item(B). { A = list_make1(B); } alterfunc_opt_list(A) ::= alterfunc_opt_list(B) common_func_opt_item(C). { A = lappend(B, C); } /* ----- opt_restrict ----- */ opt_restrict(A) ::= RESTRICT. /* ----- removeFuncStmt ----- */ removeFuncStmt(A) ::= DROP FUNCTION function_with_argtypes_list(D) opt_drop_behavior(E). { dropStmt *n = makeNode(dropStmt); n->removeType = OBJECT_FUNCTION; n->objects = D; n->behavior = E; n->missing_ok = false; n->concurrent = false; A = (Node *) n; } removeFuncStmt(A) ::= DROP FUNCTION IF_P EXISTS function_with_argtypes_list(F) opt_drop_behavior(G). { dropStmt *n = makeNode(dropStmt); n->removeType = OBJECT_FUNCTION; n->objects = F; n->behavior = G; n->missing_ok = true; n->concurrent = false; A = (Node *) n; } removeFuncStmt(A) ::= DROP PROCEDURE function_with_argtypes_list(D) opt_drop_behavior(E). { dropStmt *n = makeNode(dropStmt); n->removeType = OBJECT_PROCEDURE; n->objects = D; n->behavior = E; n->missing_ok = false; n->concurrent = false; A = (Node *) n; } removeFuncStmt(A) ::= DROP PROCEDURE IF_P EXISTS function_with_argtypes_list(F) opt_drop_behavior(G). { dropStmt *n = makeNode(dropStmt); n->removeType = OBJECT_PROCEDURE; n->objects = F; n->behavior = G; n->missing_ok = true; n->concurrent = false; A = (Node *) n; } removeFuncStmt(A) ::= DROP ROUTINE function_with_argtypes_list(D) opt_drop_behavior(E). { dropStmt *n = makeNode(dropStmt); n->removeType = OBJECT_ROUTINE; n->objects = D; n->behavior = E; n->missing_ok = false; n->concurrent = false; A = (Node *) n; } removeFuncStmt(A) ::= DROP ROUTINE IF_P EXISTS function_with_argtypes_list(F) opt_drop_behavior(G). { dropStmt *n = makeNode(dropStmt); n->removeType = OBJECT_ROUTINE; n->objects = F; n->behavior = G; n->missing_ok = true; n->concurrent = false; A = (Node *) n; } /* ----- removeAggrStmt ----- */ removeAggrStmt(A) ::= DROP AGGREGATE aggregate_with_argtypes_list(D) opt_drop_behavior(E). { dropStmt *n = makeNode(dropStmt); n->removeType = OBJECT_AGGREGATE; n->objects = D; n->behavior = E; n->missing_ok = false; n->concurrent = false; A = (Node *) n; } removeAggrStmt(A) ::= DROP AGGREGATE IF_P EXISTS aggregate_with_argtypes_list(F) opt_drop_behavior(G). { dropStmt *n = makeNode(dropStmt); n->removeType = OBJECT_AGGREGATE; n->objects = F; n->behavior = G; n->missing_ok = true; n->concurrent = false; A = (Node *) n; } /* ----- removeOperStmt ----- */ removeOperStmt(A) ::= DROP OPERATOR operator_with_argtypes_list(D) opt_drop_behavior(E). { dropStmt *n = makeNode(dropStmt); n->removeType = OBJECT_OPERATOR; n->objects = D; n->behavior = E; n->missing_ok = false; n->concurrent = false; A = (Node *) n; } removeOperStmt(A) ::= DROP OPERATOR IF_P EXISTS operator_with_argtypes_list(F) opt_drop_behavior(G). { dropStmt *n = makeNode(dropStmt); n->removeType = OBJECT_OPERATOR; n->objects = F; n->behavior = G; n->missing_ok = true; n->concurrent = false; A = (Node *) n; } /* ----- oper_argtypes ----- */ oper_argtypes(A) ::= LPAREN typename(C) RPAREN. { ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("missing argument"), errhint("Use NONE to denote the missing argument of a unary operator."), parser_errposition(LOC(D)))); } oper_argtypes(A) ::= LPAREN typename(C) COMMA typename(E) RPAREN. { A = list_make2(C, E); } oper_argtypes(A) ::= LPAREN NONE COMMA typename(E) RPAREN. { A = list_make2(NULL, E); } oper_argtypes(A) ::= LPAREN typename(C) COMMA NONE RPAREN. { A = list_make2(C, NULL); } /* ----- any_operator ----- */ any_operator(A) ::= all_Op(B). { A = list_make1(makeString(B)); } any_operator(A) ::= colId(B) DOT any_operator(D). { A = lcons(makeString(B), D); } /* ----- operator_with_argtypes_list ----- */ operator_with_argtypes_list(A) ::= operator_with_argtypes(B). { A = list_make1(B); } operator_with_argtypes_list(A) ::= operator_with_argtypes_list(B) COMMA operator_with_argtypes(D). { A = lappend(B, D); } /* ----- operator_with_argtypes ----- */ operator_with_argtypes(A) ::= any_operator(B) oper_argtypes(C). { ObjectWithArgs *n = makeNode(ObjectWithArgs); n->objname = B; n->objargs = C; A = n; } /* ----- doStmt ----- */ doStmt(A) ::= DO dostmt_opt_list(C). { doStmt *n = makeNode(doStmt); n->args = C; A = (Node *) n; } /* ----- dostmt_opt_list ----- */ dostmt_opt_list(A) ::= dostmt_opt_item(B). { A = list_make1(B); } dostmt_opt_list(A) ::= dostmt_opt_list(B) dostmt_opt_item(C). { A = lappend(B, C); } /* ----- dostmt_opt_item ----- */ dostmt_opt_item(A) ::= sconst(B). { A = makeDefElem("as", (Node *) makeString(B), LOC(B)); } dostmt_opt_item(A) ::= LANGUAGE nonReservedWord_or_Sconst(C). { A = makeDefElem("language", (Node *) makeString(C), LOC(B)); } /* ----- createCastStmt ----- */ createCastStmt(A) ::= CREATE CAST LPAREN typename(E) AS typename(G) RPAREN WITH FUNCTION function_with_argtypes(K) cast_context(L). { createCastStmt *n = makeNode(createCastStmt); n->sourcetype = E; n->targettype = G; n->func = K; n->context = (CoercionContext) L; n->inout = false; A = (Node *) n; } createCastStmt(A) ::= CREATE CAST LPAREN typename(E) AS typename(G) RPAREN WITHOUT FUNCTION cast_context(K). { createCastStmt *n = makeNode(createCastStmt); n->sourcetype = E; n->targettype = G; n->func = NULL; n->context = (CoercionContext) K; n->inout = false; A = (Node *) n; } createCastStmt(A) ::= CREATE CAST LPAREN typename(E) AS typename(G) RPAREN WITH INOUT cast_context(K). { createCastStmt *n = makeNode(createCastStmt); n->sourcetype = E; n->targettype = G; n->func = NULL; n->context = (CoercionContext) K; n->inout = true; A = (Node *) n; } /* ----- cast_context ----- */ cast_context(A) ::= AS IMPLICIT_P. { A = COERCION_IMPLICIT; } cast_context(A) ::= AS ASSIGNMENT. { A = COERCION_ASSIGNMENT; } cast_context(A) ::= . { A = COERCION_EXPLICIT; } /* ----- dropCastStmt ----- */ dropCastStmt(A) ::= DROP CAST opt_if_exists(D) LPAREN typename(F) AS typename(H) RPAREN opt_drop_behavior(J). { dropStmt *n = makeNode(dropStmt); n->removeType = OBJECT_CAST; n->objects = list_make1(list_make2(F, H)); n->behavior = J; n->missing_ok = D; n->concurrent = false; A = (Node *) n; } /* ----- opt_if_exists ----- */ opt_if_exists(A) ::= IF_P EXISTS. { A = true; } opt_if_exists(A) ::= . { A = false; } /* ----- createPropGraphStmt ----- */ createPropGraphStmt(A) ::= CREATE optTemp(C) PROPERTY GRAPH qualified_name(F) opt_vertex_tables_clause(G) opt_edge_tables_clause(H). { createPropGraphStmt *n = makeNode(createPropGraphStmt); n->pgname = F; n->pgname->relpersistence = C; n->vertex_tables = G; n->edge_tables = H; A = (Node *)n; } /* ----- opt_vertex_tables_clause ----- */ opt_vertex_tables_clause(A) ::= vertex_tables_clause(B). { A = B; } opt_vertex_tables_clause(A) ::= . { A = NIL; } /* ----- vertex_tables_clause ----- */ vertex_tables_clause(A) ::= vertex_synonym(B) TABLES LPAREN vertex_table_list(E) RPAREN. { A = E; } /* ----- vertex_synonym ----- */ vertex_synonym(A) ::= NODE. vertex_synonym(A) ::= VERTEX. /* ----- vertex_table_list ----- */ vertex_table_list(A) ::= vertex_table_definition(B). { A = list_make1(B); } vertex_table_list(A) ::= vertex_table_list(B) COMMA vertex_table_definition(D). { A = lappend(B, D); } /* ----- vertex_table_definition ----- */ vertex_table_definition(A) ::= qualified_name(B) opt_propgraph_table_alias(C) opt_graph_table_key_clause(D) opt_element_table_label_and_properties(E). { PropGraphVertex *n = makeNode(PropGraphVertex); B->alias = C; n->vtable = B; n->vkey = D; n->labels = E; n->location = LOC(B); A = (Node *) n; } /* ----- opt_propgraph_table_alias ----- */ opt_propgraph_table_alias(A) ::= AS name(C). { A = makeNode(Alias); A->aliasname = C; } opt_propgraph_table_alias(A) ::= . { A = NULL; } /* ----- opt_graph_table_key_clause ----- */ opt_graph_table_key_clause(A) ::= KEY LPAREN columnList(D) RPAREN. { A = D; } opt_graph_table_key_clause(A) ::= . { A = NIL; } /* ----- opt_edge_tables_clause ----- */ opt_edge_tables_clause(A) ::= edge_tables_clause(B). { A = B; } opt_edge_tables_clause(A) ::= . { A = NIL; } /* ----- edge_tables_clause ----- */ edge_tables_clause(A) ::= edge_synonym(B) TABLES LPAREN edge_table_list(E) RPAREN. { A = E; } /* ----- edge_synonym ----- */ edge_synonym(A) ::= EDGE. edge_synonym(A) ::= RELATIONSHIP. /* ----- edge_table_list ----- */ edge_table_list(A) ::= edge_table_definition(B). { A = list_make1(B); } edge_table_list(A) ::= edge_table_list(B) COMMA edge_table_definition(D). { A = lappend(B, D); } /* ----- edge_table_definition ----- */ edge_table_definition(A) ::= qualified_name(B) opt_propgraph_table_alias(C) opt_graph_table_key_clause(D) source_vertex_table(E) destination_vertex_table(F) opt_element_table_label_and_properties(G). { PropGraphEdge *n = makeNode(PropGraphEdge); B->alias = C; n->etable = B; n->ekey = D; n->esrckey = linitial(E); n->esrcvertex = lsecond(E); n->esrcvertexcols = lthird(E); n->edestkey = linitial(F); n->edestvertex = lsecond(F); n->edestvertexcols = lthird(F); n->labels = G; n->location = LOC(B); A = (Node *) n; } /* ----- source_vertex_table ----- */ source_vertex_table(A) ::= SOURCE name(C). { A = list_make3(NULL, C, NULL); } source_vertex_table(A) ::= SOURCE KEY LPAREN columnList(E) RPAREN REFERENCES name(H) LPAREN columnList(J) RPAREN. { A = list_make3(E, H, J); } /* ----- destination_vertex_table ----- */ destination_vertex_table(A) ::= DESTINATION name(C). { A = list_make3(NULL, C, NULL); } destination_vertex_table(A) ::= DESTINATION KEY LPAREN columnList(E) RPAREN REFERENCES name(H) LPAREN columnList(J) RPAREN. { A = list_make3(E, H, J); } /* ----- opt_element_table_label_and_properties ----- */ opt_element_table_label_and_properties(A) ::= element_table_properties(B). { PropGraphLabelAndProperties *lp = makeNode(PropGraphLabelAndProperties); lp->properties = (PropGraphProperties *) B; lp->location = LOC(B); A = list_make1(lp); } opt_element_table_label_and_properties(A) ::= label_and_properties_list(B). { A = B; } opt_element_table_label_and_properties(A) ::= . { PropGraphLabelAndProperties *lp = makeNode(PropGraphLabelAndProperties); PropGraphProperties *pr = makeNode(PropGraphProperties); pr->all = true; pr->location = -1; lp->properties = pr; lp->location = -1; A = list_make1(lp); } /* ----- element_table_properties ----- */ element_table_properties(A) ::= NO PROPERTIES. { PropGraphProperties *pr = makeNode(PropGraphProperties); pr->properties = NIL; pr->location = LOC(B); A = (Node *) pr; } element_table_properties(A) ::= PROPERTIES ALL COLUMNS. { PropGraphProperties *pr = makeNode(PropGraphProperties); pr->all = true; pr->location = LOC(B); A = (Node *) pr; } element_table_properties(A) ::= PROPERTIES LPAREN labeled_expr_list(D) RPAREN. { PropGraphProperties *pr = makeNode(PropGraphProperties); pr->properties = D; pr->location = LOC(B); A = (Node *) pr; } /* ----- label_and_properties_list ----- */ label_and_properties_list(A) ::= label_and_properties(B). { A = list_make1(B); } label_and_properties_list(A) ::= label_and_properties_list(B) label_and_properties(C). { A = lappend(B, C); } /* ----- label_and_properties ----- */ label_and_properties(A) ::= element_table_label_clause(B). { PropGraphLabelAndProperties *lp = makeNode(PropGraphLabelAndProperties); PropGraphProperties *pr = makeNode(PropGraphProperties); pr->all = true; pr->location = -1; lp->label = B; lp->properties = pr; lp->location = LOC(B); A = (Node *) lp; } label_and_properties(A) ::= element_table_label_clause(B) element_table_properties(C). { PropGraphLabelAndProperties *lp = makeNode(PropGraphLabelAndProperties); lp->label = B; lp->properties = (PropGraphProperties *) C; lp->location = LOC(B); A = (Node *) lp; } /* ----- element_table_label_clause ----- */ element_table_label_clause(A) ::= LABEL name(C). { A = C; } element_table_label_clause(A) ::= DEFAULT LABEL. { A = NULL; } /* ----- alterPropGraphStmt ----- */ alterPropGraphStmt(A) ::= ALTER PROPERTY GRAPH qualified_name(E) ADD_P vertex_tables_clause(G). { alterPropGraphStmt *n = makeNode(alterPropGraphStmt); n->pgname = E; n->add_vertex_tables = G; A = (Node *) n; } alterPropGraphStmt(A) ::= ALTER PROPERTY GRAPH qualified_name(E) ADD_P vertex_tables_clause(G) ADD_P edge_tables_clause(I). { alterPropGraphStmt *n = makeNode(alterPropGraphStmt); n->pgname = E; n->add_vertex_tables = G; n->add_edge_tables = I; A = (Node *) n; } alterPropGraphStmt(A) ::= ALTER PROPERTY GRAPH qualified_name(E) ADD_P edge_tables_clause(G). { alterPropGraphStmt *n = makeNode(alterPropGraphStmt); n->pgname = E; n->add_edge_tables = G; A = (Node *) n; } alterPropGraphStmt(A) ::= ALTER PROPERTY GRAPH qualified_name(E) DROP vertex_synonym(G) TABLES LPAREN name_list(J) RPAREN opt_drop_behavior(L). { alterPropGraphStmt *n = makeNode(alterPropGraphStmt); n->pgname = E; n->drop_vertex_tables = J; n->drop_behavior = L; A = (Node *) n; } alterPropGraphStmt(A) ::= ALTER PROPERTY GRAPH qualified_name(E) DROP edge_synonym(G) TABLES LPAREN name_list(J) RPAREN opt_drop_behavior(L). { alterPropGraphStmt *n = makeNode(alterPropGraphStmt); n->pgname = E; n->drop_edge_tables = J; n->drop_behavior = L; A = (Node *) n; } alterPropGraphStmt(A) ::= ALTER PROPERTY GRAPH qualified_name(E) ALTER vertex_or_edge(G) TABLE name(I) add_label_list(J). { alterPropGraphStmt *n = makeNode(alterPropGraphStmt); n->pgname = E; n->element_kind = G; n->element_alias = I; n->add_labels = J; A = (Node *) n; } alterPropGraphStmt(A) ::= ALTER PROPERTY GRAPH qualified_name(E) ALTER vertex_or_edge(G) TABLE name(I) DROP LABEL name(L) opt_drop_behavior(M). { alterPropGraphStmt *n = makeNode(alterPropGraphStmt); n->pgname = E; n->element_kind = G; n->element_alias = I; n->drop_label = L; n->drop_behavior = M; A = (Node *) n; } alterPropGraphStmt(A) ::= ALTER PROPERTY GRAPH qualified_name(E) ALTER vertex_or_edge(G) TABLE name(I) ALTER LABEL name(L) ADD_P PROPERTIES LPAREN labeled_expr_list(P) RPAREN. { alterPropGraphStmt *n = makeNode(alterPropGraphStmt); PropGraphProperties *pr = makeNode(PropGraphProperties); n->pgname = E; n->element_kind = G; n->element_alias = I; n->alter_label = L; pr->properties = P; pr->location = LOC(N); n->add_properties = pr; A = (Node *) n; } alterPropGraphStmt(A) ::= ALTER PROPERTY GRAPH qualified_name(E) ALTER vertex_or_edge(G) TABLE name(I) ALTER LABEL name(L) DROP PROPERTIES LPAREN name_list(P) RPAREN opt_drop_behavior(R). { alterPropGraphStmt *n = makeNode(alterPropGraphStmt); n->pgname = E; n->element_kind = G; n->element_alias = I; n->alter_label = L; n->drop_properties = P; n->drop_behavior = R; A = (Node *) n; } /* ----- vertex_or_edge ----- */ vertex_or_edge(A) ::= vertex_synonym(B). { A = PROPGRAPH_ELEMENT_KIND_VERTEX; } vertex_or_edge(A) ::= edge_synonym(B). { A = PROPGRAPH_ELEMENT_KIND_EDGE; } /* ----- add_label_list ----- */ add_label_list(A) ::= add_label(B). { A = list_make1(B); } add_label_list(A) ::= add_label_list(B) add_label(C). { A = lappend(B, C); } /* ----- add_label ----- */ add_label(A) ::= ADD_P LABEL name(D) element_table_properties(E). { PropGraphLabelAndProperties *lp = makeNode(PropGraphLabelAndProperties); lp->label = D; lp->properties = (PropGraphProperties *) E; lp->location = LOC(B); A = (Node *) lp; } /* ----- createTransformStmt ----- */ createTransformStmt(A) ::= CREATE opt_or_replace(C) TRANSFORM FOR typename(F) LANGUAGE name(H) LPAREN transform_element_list(J) RPAREN. { createTransformStmt *n = makeNode(createTransformStmt); n->replace = C; n->type_name = F; n->lang = H; n->fromsql = linitial(J); n->tosql = lsecond(J); A = (Node *) n; } /* ----- transform_element_list ----- */ transform_element_list(A) ::= FROM SQL_P WITH FUNCTION function_with_argtypes(F) COMMA TO SQL_P WITH FUNCTION function_with_argtypes(L). { A = list_make2(F, L); } transform_element_list(A) ::= TO SQL_P WITH FUNCTION function_with_argtypes(F) COMMA FROM SQL_P WITH FUNCTION function_with_argtypes(L). { A = list_make2(L, F); } transform_element_list(A) ::= FROM SQL_P WITH FUNCTION function_with_argtypes(F). { A = list_make2(F, NULL); } transform_element_list(A) ::= TO SQL_P WITH FUNCTION function_with_argtypes(F). { A = list_make2(NULL, F); } /* ----- dropTransformStmt ----- */ dropTransformStmt(A) ::= DROP TRANSFORM opt_if_exists(D) FOR typename(F) LANGUAGE name(H) opt_drop_behavior(I). { dropStmt *n = makeNode(dropStmt); n->removeType = OBJECT_TRANSFORM; n->objects = list_make1(list_make2(F, makeString(H))); n->behavior = I; n->missing_ok = D; A = (Node *) n; } /* ----- reindexStmt ----- */ reindexStmt(A) ::= REINDEX opt_utility_option_list(C) reindex_target_relation(D) opt_concurrently(E) qualified_name(F). { reindexStmt *n = makeNode(reindexStmt); n->kind = D; n->relation = F; n->name = NULL; n->params = C; if (E) n->params = lappend(n->params, makeDefElem("concurrently", NULL, LOC(E))); A = (Node *) n; } reindexStmt(A) ::= REINDEX opt_utility_option_list(C) SCHEMA opt_concurrently(E) name(F). { reindexStmt *n = makeNode(reindexStmt); n->kind = REINDEX_OBJECT_SCHEMA; n->relation = NULL; n->name = F; n->params = C; if (E) n->params = lappend(n->params, makeDefElem("concurrently", NULL, LOC(E))); A = (Node *) n; } reindexStmt(A) ::= REINDEX opt_utility_option_list(C) reindex_target_all(D) opt_concurrently(E) opt_single_name(F). { reindexStmt *n = makeNode(reindexStmt); n->kind = D; n->relation = NULL; n->name = F; n->params = C; if (E) n->params = lappend(n->params, makeDefElem("concurrently", NULL, LOC(E))); A = (Node *) n; } /* ----- reindex_target_relation ----- */ reindex_target_relation(A) ::= INDEX. { A = REINDEX_OBJECT_INDEX; } reindex_target_relation(A) ::= TABLE. { A = REINDEX_OBJECT_TABLE; } /* ----- reindex_target_all ----- */ reindex_target_all(A) ::= SYSTEM_P. { A = REINDEX_OBJECT_SYSTEM; } reindex_target_all(A) ::= DATABASE. { A = REINDEX_OBJECT_DATABASE; } /* ----- alterTblSpcStmt ----- */ alterTblSpcStmt(A) ::= ALTER TABLESPACE name(D) SET reloptions(F). { AlterTableSpaceOptionsStmt *n = makeNode(AlterTableSpaceOptionsStmt); n->tablespacename = D; n->options = F; n->isReset = false; A = (Node *) n; } alterTblSpcStmt(A) ::= ALTER TABLESPACE name(D) RESET reloptions(F). { AlterTableSpaceOptionsStmt *n = makeNode(AlterTableSpaceOptionsStmt); n->tablespacename = D; n->options = F; n->isReset = true; A = (Node *) n; } /* ----- renameStmt ----- */ renameStmt(A) ::= ALTER AGGREGATE aggregate_with_argtypes(D) RENAME TO name(G). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_AGGREGATE; n->object = (Node *) D; n->newname = G; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER COLLATION any_name(D) RENAME TO name(G). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_COLLATION; n->object = (Node *) D; n->newname = G; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER CONVERSION_P any_name(D) RENAME TO name(G). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_CONVERSION; n->object = (Node *) D; n->newname = G; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER DATABASE name(D) RENAME TO name(G). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_DATABASE; n->subname = D; n->newname = G; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER DOMAIN_P any_name(D) RENAME TO name(G). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_DOMAIN; n->object = (Node *) D; n->newname = G; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER DOMAIN_P any_name(D) RENAME CONSTRAINT name(G) TO name(I). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_DOMCONSTRAINT; n->object = (Node *) D; n->subname = G; n->newname = I; A = (Node *) n; } renameStmt(A) ::= ALTER FOREIGN DATA_P WRAPPER name(F) RENAME TO name(I). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_FDW; n->object = (Node *) makeString(F); n->newname = I; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER FUNCTION function_with_argtypes(D) RENAME TO name(G). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_FUNCTION; n->object = (Node *) D; n->newname = G; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER GROUP_P roleId(D) RENAME TO roleId(G). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_ROLE; n->subname = D; n->newname = G; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER opt_procedural(C) LANGUAGE name(E) RENAME TO name(H). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_LANGUAGE; n->object = (Node *) makeString(E); n->newname = H; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER OPERATOR CLASS any_name(E) USING name(G) RENAME TO name(J). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_OPCLASS; n->object = (Node *) lcons(makeString(G), E); n->newname = J; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER OPERATOR FAMILY any_name(E) USING name(G) RENAME TO name(J). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_OPFAMILY; n->object = (Node *) lcons(makeString(G), E); n->newname = J; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER POLICY name(D) ON qualified_name(F) RENAME TO name(I). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_POLICY; n->relation = F; n->subname = D; n->newname = I; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER POLICY IF_P EXISTS name(F) ON qualified_name(H) RENAME TO name(K). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_POLICY; n->relation = H; n->subname = F; n->newname = K; n->missing_ok = true; A = (Node *) n; } renameStmt(A) ::= ALTER PROCEDURE function_with_argtypes(D) RENAME TO name(G). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_PROCEDURE; n->object = (Node *) D; n->newname = G; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER PROPERTY GRAPH qualified_name(E) RENAME TO name(H). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_PROPGRAPH; n->relation = E; n->newname = H; n->missing_ok = false; A = (Node *)n; } renameStmt(A) ::= ALTER PUBLICATION name(D) RENAME TO name(G). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_PUBLICATION; n->object = (Node *) makeString(D); n->newname = G; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER ROUTINE function_with_argtypes(D) RENAME TO name(G). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_ROUTINE; n->object = (Node *) D; n->newname = G; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER SCHEMA name(D) RENAME TO name(G). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_SCHEMA; n->subname = D; n->newname = G; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER SERVER name(D) RENAME TO name(G). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_FOREIGN_SERVER; n->object = (Node *) makeString(D); n->newname = G; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER SUBSCRIPTION name(D) RENAME TO name(G). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_SUBSCRIPTION; n->object = (Node *) makeString(D); n->newname = G; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER TABLE relation_expr(D) RENAME TO name(G). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_TABLE; n->relation = D; n->subname = NULL; n->newname = G; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER TABLE IF_P EXISTS relation_expr(F) RENAME TO name(I). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_TABLE; n->relation = F; n->subname = NULL; n->newname = I; n->missing_ok = true; A = (Node *) n; } renameStmt(A) ::= ALTER SEQUENCE qualified_name(D) RENAME TO name(G). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_SEQUENCE; n->relation = D; n->subname = NULL; n->newname = G; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER SEQUENCE IF_P EXISTS qualified_name(F) RENAME TO name(I). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_SEQUENCE; n->relation = F; n->subname = NULL; n->newname = I; n->missing_ok = true; A = (Node *) n; } renameStmt(A) ::= ALTER VIEW qualified_name(D) RENAME TO name(G). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_VIEW; n->relation = D; n->subname = NULL; n->newname = G; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER VIEW IF_P EXISTS qualified_name(F) RENAME TO name(I). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_VIEW; n->relation = F; n->subname = NULL; n->newname = I; n->missing_ok = true; A = (Node *) n; } renameStmt(A) ::= ALTER MATERIALIZED VIEW qualified_name(E) RENAME TO name(H). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_MATVIEW; n->relation = E; n->subname = NULL; n->newname = H; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER MATERIALIZED VIEW IF_P EXISTS qualified_name(G) RENAME TO name(J). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_MATVIEW; n->relation = G; n->subname = NULL; n->newname = J; n->missing_ok = true; A = (Node *) n; } renameStmt(A) ::= ALTER INDEX qualified_name(D) RENAME TO name(G). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_INDEX; n->relation = D; n->subname = NULL; n->newname = G; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER INDEX IF_P EXISTS qualified_name(F) RENAME TO name(I). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_INDEX; n->relation = F; n->subname = NULL; n->newname = I; n->missing_ok = true; A = (Node *) n; } renameStmt(A) ::= ALTER FOREIGN TABLE relation_expr(E) RENAME TO name(H). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_FOREIGN_TABLE; n->relation = E; n->subname = NULL; n->newname = H; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER FOREIGN TABLE IF_P EXISTS relation_expr(G) RENAME TO name(J). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_FOREIGN_TABLE; n->relation = G; n->subname = NULL; n->newname = J; n->missing_ok = true; A = (Node *) n; } renameStmt(A) ::= ALTER TABLE relation_expr(D) RENAME opt_column(F) name(G) TO name(I). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_COLUMN; n->relationType = OBJECT_TABLE; n->relation = D; n->subname = G; n->newname = I; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER TABLE IF_P EXISTS relation_expr(F) RENAME opt_column(H) name(I) TO name(K). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_COLUMN; n->relationType = OBJECT_TABLE; n->relation = F; n->subname = I; n->newname = K; n->missing_ok = true; A = (Node *) n; } renameStmt(A) ::= ALTER VIEW qualified_name(D) RENAME opt_column(F) name(G) TO name(I). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_COLUMN; n->relationType = OBJECT_VIEW; n->relation = D; n->subname = G; n->newname = I; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER VIEW IF_P EXISTS qualified_name(F) RENAME opt_column(H) name(I) TO name(K). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_COLUMN; n->relationType = OBJECT_VIEW; n->relation = F; n->subname = I; n->newname = K; n->missing_ok = true; A = (Node *) n; } renameStmt(A) ::= ALTER MATERIALIZED VIEW qualified_name(E) RENAME opt_column(G) name(H) TO name(J). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_COLUMN; n->relationType = OBJECT_MATVIEW; n->relation = E; n->subname = H; n->newname = J; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER MATERIALIZED VIEW IF_P EXISTS qualified_name(G) RENAME opt_column(I) name(J) TO name(L). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_COLUMN; n->relationType = OBJECT_MATVIEW; n->relation = G; n->subname = J; n->newname = L; n->missing_ok = true; A = (Node *) n; } renameStmt(A) ::= ALTER TABLE relation_expr(D) RENAME CONSTRAINT name(G) TO name(I). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_TABCONSTRAINT; n->relation = D; n->subname = G; n->newname = I; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER TABLE IF_P EXISTS relation_expr(F) RENAME CONSTRAINT name(I) TO name(K). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_TABCONSTRAINT; n->relation = F; n->subname = I; n->newname = K; n->missing_ok = true; A = (Node *) n; } renameStmt(A) ::= ALTER FOREIGN TABLE relation_expr(E) RENAME opt_column(G) name(H) TO name(J). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_COLUMN; n->relationType = OBJECT_FOREIGN_TABLE; n->relation = E; n->subname = H; n->newname = J; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER FOREIGN TABLE IF_P EXISTS relation_expr(G) RENAME opt_column(I) name(J) TO name(L). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_COLUMN; n->relationType = OBJECT_FOREIGN_TABLE; n->relation = G; n->subname = J; n->newname = L; n->missing_ok = true; A = (Node *) n; } renameStmt(A) ::= ALTER RULE name(D) ON qualified_name(F) RENAME TO name(I). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_RULE; n->relation = F; n->subname = D; n->newname = I; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER TRIGGER name(D) ON qualified_name(F) RENAME TO name(I). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_TRIGGER; n->relation = F; n->subname = D; n->newname = I; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER EVENT TRIGGER name(E) RENAME TO name(H). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_EVENT_TRIGGER; n->object = (Node *) makeString(E); n->newname = H; A = (Node *) n; } renameStmt(A) ::= ALTER ROLE roleId(D) RENAME TO roleId(G). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_ROLE; n->subname = D; n->newname = G; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER USER roleId(D) RENAME TO roleId(G). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_ROLE; n->subname = D; n->newname = G; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER TABLESPACE name(D) RENAME TO name(G). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_TABLESPACE; n->subname = D; n->newname = G; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER STATISTICS any_name(D) RENAME TO name(G). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_STATISTIC_EXT; n->object = (Node *) D; n->newname = G; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER TEXT_P SEARCH PARSER any_name(F) RENAME TO name(I). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_TSPARSER; n->object = (Node *) F; n->newname = I; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER TEXT_P SEARCH DICTIONARY any_name(F) RENAME TO name(I). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_TSDICTIONARY; n->object = (Node *) F; n->newname = I; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER TEXT_P SEARCH TEMPLATE any_name(F) RENAME TO name(I). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_TSTEMPLATE; n->object = (Node *) F; n->newname = I; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER TEXT_P SEARCH CONFIGURATION any_name(F) RENAME TO name(I). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_TSCONFIGURATION; n->object = (Node *) F; n->newname = I; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER TYPE_P any_name(D) RENAME TO name(G). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_TYPE; n->object = (Node *) D; n->newname = G; n->missing_ok = false; A = (Node *) n; } renameStmt(A) ::= ALTER TYPE_P any_name(D) RENAME ATTRIBUTE name(G) TO name(I) opt_drop_behavior(J). { renameStmt *n = makeNode(renameStmt); n->renameType = OBJECT_ATTRIBUTE; n->relationType = OBJECT_TYPE; n->relation = makeRangeVarFromAnyName(D, LOC(D), yyscanner); n->subname = G; n->newname = I; n->behavior = J; n->missing_ok = false; A = (Node *) n; } /* ----- opt_column ----- */ opt_column(A) ::= COLUMN. /* ----- opt_set_data ----- */ opt_set_data(A) ::= SET DATA_P. { A = 1; } opt_set_data(A) ::= . { A = 0; } /* ----- alterObjectDependsStmt ----- */ alterObjectDependsStmt(A) ::= ALTER FUNCTION function_with_argtypes(D) opt_no(E) DEPENDS ON EXTENSION name(I). { alterObjectDependsStmt *n = makeNode(alterObjectDependsStmt); n->objectType = OBJECT_FUNCTION; n->object = (Node *) D; n->extname = makeString(I); n->remove = E; A = (Node *) n; } alterObjectDependsStmt(A) ::= ALTER PROCEDURE function_with_argtypes(D) opt_no(E) DEPENDS ON EXTENSION name(I). { alterObjectDependsStmt *n = makeNode(alterObjectDependsStmt); n->objectType = OBJECT_PROCEDURE; n->object = (Node *) D; n->extname = makeString(I); n->remove = E; A = (Node *) n; } alterObjectDependsStmt(A) ::= ALTER ROUTINE function_with_argtypes(D) opt_no(E) DEPENDS ON EXTENSION name(I). { alterObjectDependsStmt *n = makeNode(alterObjectDependsStmt); n->objectType = OBJECT_ROUTINE; n->object = (Node *) D; n->extname = makeString(I); n->remove = E; A = (Node *) n; } alterObjectDependsStmt(A) ::= ALTER TRIGGER name(D) ON qualified_name(F) opt_no(G) DEPENDS ON EXTENSION name(K). { alterObjectDependsStmt *n = makeNode(alterObjectDependsStmt); n->objectType = OBJECT_TRIGGER; n->relation = F; n->object = (Node *) list_make1(makeString(D)); n->extname = makeString(K); n->remove = G; A = (Node *) n; } alterObjectDependsStmt(A) ::= ALTER MATERIALIZED VIEW qualified_name(E) opt_no(F) DEPENDS ON EXTENSION name(J). { alterObjectDependsStmt *n = makeNode(alterObjectDependsStmt); n->objectType = OBJECT_MATVIEW; n->relation = E; n->extname = makeString(J); n->remove = F; A = (Node *) n; } alterObjectDependsStmt(A) ::= ALTER INDEX qualified_name(D) opt_no(E) DEPENDS ON EXTENSION name(I). { alterObjectDependsStmt *n = makeNode(alterObjectDependsStmt); n->objectType = OBJECT_INDEX; n->relation = D; n->extname = makeString(I); n->remove = E; A = (Node *) n; } /* ----- opt_no ----- */ opt_no(A) ::= NO. { A = true; } opt_no(A) ::= . { A = false; } /* ----- alterObjectSchemaStmt ----- */ alterObjectSchemaStmt(A) ::= ALTER AGGREGATE aggregate_with_argtypes(D) SET SCHEMA name(G). { alterObjectSchemaStmt *n = makeNode(alterObjectSchemaStmt); n->objectType = OBJECT_AGGREGATE; n->object = (Node *) D; n->newschema = G; n->missing_ok = false; A = (Node *) n; } alterObjectSchemaStmt(A) ::= ALTER COLLATION any_name(D) SET SCHEMA name(G). { alterObjectSchemaStmt *n = makeNode(alterObjectSchemaStmt); n->objectType = OBJECT_COLLATION; n->object = (Node *) D; n->newschema = G; n->missing_ok = false; A = (Node *) n; } alterObjectSchemaStmt(A) ::= ALTER CONVERSION_P any_name(D) SET SCHEMA name(G). { alterObjectSchemaStmt *n = makeNode(alterObjectSchemaStmt); n->objectType = OBJECT_CONVERSION; n->object = (Node *) D; n->newschema = G; n->missing_ok = false; A = (Node *) n; } alterObjectSchemaStmt(A) ::= ALTER DOMAIN_P any_name(D) SET SCHEMA name(G). { alterObjectSchemaStmt *n = makeNode(alterObjectSchemaStmt); n->objectType = OBJECT_DOMAIN; n->object = (Node *) D; n->newschema = G; n->missing_ok = false; A = (Node *) n; } alterObjectSchemaStmt(A) ::= ALTER EXTENSION name(D) SET SCHEMA name(G). { alterObjectSchemaStmt *n = makeNode(alterObjectSchemaStmt); n->objectType = OBJECT_EXTENSION; n->object = (Node *) makeString(D); n->newschema = G; n->missing_ok = false; A = (Node *) n; } alterObjectSchemaStmt(A) ::= ALTER FUNCTION function_with_argtypes(D) SET SCHEMA name(G). { alterObjectSchemaStmt *n = makeNode(alterObjectSchemaStmt); n->objectType = OBJECT_FUNCTION; n->object = (Node *) D; n->newschema = G; n->missing_ok = false; A = (Node *) n; } alterObjectSchemaStmt(A) ::= ALTER OPERATOR operator_with_argtypes(D) SET SCHEMA name(G). { alterObjectSchemaStmt *n = makeNode(alterObjectSchemaStmt); n->objectType = OBJECT_OPERATOR; n->object = (Node *) D; n->newschema = G; n->missing_ok = false; A = (Node *) n; } alterObjectSchemaStmt(A) ::= ALTER OPERATOR CLASS any_name(E) USING name(G) SET SCHEMA name(J). { alterObjectSchemaStmt *n = makeNode(alterObjectSchemaStmt); n->objectType = OBJECT_OPCLASS; n->object = (Node *) lcons(makeString(G), E); n->newschema = J; n->missing_ok = false; A = (Node *) n; } alterObjectSchemaStmt(A) ::= ALTER OPERATOR FAMILY any_name(E) USING name(G) SET SCHEMA name(J). { alterObjectSchemaStmt *n = makeNode(alterObjectSchemaStmt); n->objectType = OBJECT_OPFAMILY; n->object = (Node *) lcons(makeString(G), E); n->newschema = J; n->missing_ok = false; A = (Node *) n; } alterObjectSchemaStmt(A) ::= ALTER PROCEDURE function_with_argtypes(D) SET SCHEMA name(G). { alterObjectSchemaStmt *n = makeNode(alterObjectSchemaStmt); n->objectType = OBJECT_PROCEDURE; n->object = (Node *) D; n->newschema = G; n->missing_ok = false; A = (Node *) n; } alterObjectSchemaStmt(A) ::= ALTER PROPERTY GRAPH qualified_name(E) SET SCHEMA name(H). { alterObjectSchemaStmt *n = makeNode(alterObjectSchemaStmt); n->objectType = OBJECT_PROPGRAPH; n->relation = E; n->newschema = H; n->missing_ok = false; A = (Node *)n; } alterObjectSchemaStmt(A) ::= ALTER PROPERTY GRAPH IF_P EXISTS qualified_name(G) SET SCHEMA name(J). { alterObjectSchemaStmt *n = makeNode(alterObjectSchemaStmt); n->objectType = OBJECT_PROPGRAPH; n->relation = G; n->newschema = J; n->missing_ok = true; A = (Node *)n; } alterObjectSchemaStmt(A) ::= ALTER ROUTINE function_with_argtypes(D) SET SCHEMA name(G). { alterObjectSchemaStmt *n = makeNode(alterObjectSchemaStmt); n->objectType = OBJECT_ROUTINE; n->object = (Node *) D; n->newschema = G; n->missing_ok = false; A = (Node *) n; } alterObjectSchemaStmt(A) ::= ALTER TABLE relation_expr(D) SET SCHEMA name(G). { alterObjectSchemaStmt *n = makeNode(alterObjectSchemaStmt); n->objectType = OBJECT_TABLE; n->relation = D; n->newschema = G; n->missing_ok = false; A = (Node *) n; } alterObjectSchemaStmt(A) ::= ALTER TABLE IF_P EXISTS relation_expr(F) SET SCHEMA name(I). { alterObjectSchemaStmt *n = makeNode(alterObjectSchemaStmt); n->objectType = OBJECT_TABLE; n->relation = F; n->newschema = I; n->missing_ok = true; A = (Node *) n; } alterObjectSchemaStmt(A) ::= ALTER STATISTICS any_name(D) SET SCHEMA name(G). { alterObjectSchemaStmt *n = makeNode(alterObjectSchemaStmt); n->objectType = OBJECT_STATISTIC_EXT; n->object = (Node *) D; n->newschema = G; n->missing_ok = false; A = (Node *) n; } alterObjectSchemaStmt(A) ::= ALTER TEXT_P SEARCH PARSER any_name(F) SET SCHEMA name(I). { alterObjectSchemaStmt *n = makeNode(alterObjectSchemaStmt); n->objectType = OBJECT_TSPARSER; n->object = (Node *) F; n->newschema = I; n->missing_ok = false; A = (Node *) n; } alterObjectSchemaStmt(A) ::= ALTER TEXT_P SEARCH DICTIONARY any_name(F) SET SCHEMA name(I). { alterObjectSchemaStmt *n = makeNode(alterObjectSchemaStmt); n->objectType = OBJECT_TSDICTIONARY; n->object = (Node *) F; n->newschema = I; n->missing_ok = false; A = (Node *) n; } alterObjectSchemaStmt(A) ::= ALTER TEXT_P SEARCH TEMPLATE any_name(F) SET SCHEMA name(I). { alterObjectSchemaStmt *n = makeNode(alterObjectSchemaStmt); n->objectType = OBJECT_TSTEMPLATE; n->object = (Node *) F; n->newschema = I; n->missing_ok = false; A = (Node *) n; } alterObjectSchemaStmt(A) ::= ALTER TEXT_P SEARCH CONFIGURATION any_name(F) SET SCHEMA name(I). { alterObjectSchemaStmt *n = makeNode(alterObjectSchemaStmt); n->objectType = OBJECT_TSCONFIGURATION; n->object = (Node *) F; n->newschema = I; n->missing_ok = false; A = (Node *) n; } alterObjectSchemaStmt(A) ::= ALTER SEQUENCE qualified_name(D) SET SCHEMA name(G). { alterObjectSchemaStmt *n = makeNode(alterObjectSchemaStmt); n->objectType = OBJECT_SEQUENCE; n->relation = D; n->newschema = G; n->missing_ok = false; A = (Node *) n; } alterObjectSchemaStmt(A) ::= ALTER SEQUENCE IF_P EXISTS qualified_name(F) SET SCHEMA name(I). { alterObjectSchemaStmt *n = makeNode(alterObjectSchemaStmt); n->objectType = OBJECT_SEQUENCE; n->relation = F; n->newschema = I; n->missing_ok = true; A = (Node *) n; } alterObjectSchemaStmt(A) ::= ALTER VIEW qualified_name(D) SET SCHEMA name(G). { alterObjectSchemaStmt *n = makeNode(alterObjectSchemaStmt); n->objectType = OBJECT_VIEW; n->relation = D; n->newschema = G; n->missing_ok = false; A = (Node *) n; } alterObjectSchemaStmt(A) ::= ALTER VIEW IF_P EXISTS qualified_name(F) SET SCHEMA name(I). { alterObjectSchemaStmt *n = makeNode(alterObjectSchemaStmt); n->objectType = OBJECT_VIEW; n->relation = F; n->newschema = I; n->missing_ok = true; A = (Node *) n; } alterObjectSchemaStmt(A) ::= ALTER MATERIALIZED VIEW qualified_name(E) SET SCHEMA name(H). { alterObjectSchemaStmt *n = makeNode(alterObjectSchemaStmt); n->objectType = OBJECT_MATVIEW; n->relation = E; n->newschema = H; n->missing_ok = false; A = (Node *) n; } alterObjectSchemaStmt(A) ::= ALTER MATERIALIZED VIEW IF_P EXISTS qualified_name(G) SET SCHEMA name(J). { alterObjectSchemaStmt *n = makeNode(alterObjectSchemaStmt); n->objectType = OBJECT_MATVIEW; n->relation = G; n->newschema = J; n->missing_ok = true; A = (Node *) n; } alterObjectSchemaStmt(A) ::= ALTER FOREIGN TABLE relation_expr(E) SET SCHEMA name(H). { alterObjectSchemaStmt *n = makeNode(alterObjectSchemaStmt); n->objectType = OBJECT_FOREIGN_TABLE; n->relation = E; n->newschema = H; n->missing_ok = false; A = (Node *) n; } alterObjectSchemaStmt(A) ::= ALTER FOREIGN TABLE IF_P EXISTS relation_expr(G) SET SCHEMA name(J). { alterObjectSchemaStmt *n = makeNode(alterObjectSchemaStmt); n->objectType = OBJECT_FOREIGN_TABLE; n->relation = G; n->newschema = J; n->missing_ok = true; A = (Node *) n; } alterObjectSchemaStmt(A) ::= ALTER TYPE_P any_name(D) SET SCHEMA name(G). { alterObjectSchemaStmt *n = makeNode(alterObjectSchemaStmt); n->objectType = OBJECT_TYPE; n->object = (Node *) D; n->newschema = G; n->missing_ok = false; A = (Node *) n; } /* ----- alterOperatorStmt ----- */ alterOperatorStmt(A) ::= ALTER OPERATOR operator_with_argtypes(D) SET LPAREN operator_def_list(G) RPAREN. { alterOperatorStmt *n = makeNode(alterOperatorStmt); n->opername = D; n->options = G; A = (Node *) n; } /* ----- operator_def_list ----- */ operator_def_list(A) ::= operator_def_elem(B). { A = list_make1(B); } operator_def_list(A) ::= operator_def_list(B) COMMA operator_def_elem(D). { A = lappend(B, D); } /* ----- operator_def_elem ----- */ operator_def_elem(A) ::= colLabel(B) EQ NONE. { A = makeDefElem(B, NULL, LOC(B)); } operator_def_elem(A) ::= colLabel(B) EQ operator_def_arg(D). { A = makeDefElem(B, (Node *) D, LOC(B)); } operator_def_elem(A) ::= colLabel(B). { A = makeDefElem(B, NULL, LOC(B)); } /* ----- operator_def_arg ----- */ operator_def_arg(A) ::= func_type(B). { A = (Node *) B; } operator_def_arg(A) ::= reserved_keyword(B). { A = (Node *) makeString(pstrdup(B)); } operator_def_arg(A) ::= qual_all_Op(B). { A = (Node *) B; } operator_def_arg(A) ::= numericOnly(B). { A = (Node *) B; } operator_def_arg(A) ::= sconst(B). { A = (Node *) makeString(B); } /* ----- alterTypeStmt ----- */ alterTypeStmt(A) ::= ALTER TYPE_P any_name(D) SET LPAREN operator_def_list(G) RPAREN. { alterTypeStmt *n = makeNode(alterTypeStmt); n->typeName = D; n->options = G; A = (Node *) n; } /* ----- alterOwnerStmt ----- */ alterOwnerStmt(A) ::= ALTER AGGREGATE aggregate_with_argtypes(D) OWNER TO roleSpec(G). { alterOwnerStmt *n = makeNode(alterOwnerStmt); n->objectType = OBJECT_AGGREGATE; n->object = (Node *) D; n->newowner = G; A = (Node *) n; } alterOwnerStmt(A) ::= ALTER COLLATION any_name(D) OWNER TO roleSpec(G). { alterOwnerStmt *n = makeNode(alterOwnerStmt); n->objectType = OBJECT_COLLATION; n->object = (Node *) D; n->newowner = G; A = (Node *) n; } alterOwnerStmt(A) ::= ALTER CONVERSION_P any_name(D) OWNER TO roleSpec(G). { alterOwnerStmt *n = makeNode(alterOwnerStmt); n->objectType = OBJECT_CONVERSION; n->object = (Node *) D; n->newowner = G; A = (Node *) n; } alterOwnerStmt(A) ::= ALTER DATABASE name(D) OWNER TO roleSpec(G). { alterOwnerStmt *n = makeNode(alterOwnerStmt); n->objectType = OBJECT_DATABASE; n->object = (Node *) makeString(D); n->newowner = G; A = (Node *) n; } alterOwnerStmt(A) ::= ALTER DOMAIN_P any_name(D) OWNER TO roleSpec(G). { alterOwnerStmt *n = makeNode(alterOwnerStmt); n->objectType = OBJECT_DOMAIN; n->object = (Node *) D; n->newowner = G; A = (Node *) n; } alterOwnerStmt(A) ::= ALTER FUNCTION function_with_argtypes(D) OWNER TO roleSpec(G). { alterOwnerStmt *n = makeNode(alterOwnerStmt); n->objectType = OBJECT_FUNCTION; n->object = (Node *) D; n->newowner = G; A = (Node *) n; } alterOwnerStmt(A) ::= ALTER opt_procedural(C) LANGUAGE name(E) OWNER TO roleSpec(H). { alterOwnerStmt *n = makeNode(alterOwnerStmt); n->objectType = OBJECT_LANGUAGE; n->object = (Node *) makeString(E); n->newowner = H; A = (Node *) n; } alterOwnerStmt(A) ::= ALTER LARGE_P OBJECT_P numericOnly(E) OWNER TO roleSpec(H). { alterOwnerStmt *n = makeNode(alterOwnerStmt); n->objectType = OBJECT_LARGEOBJECT; n->object = (Node *) E; n->newowner = H; A = (Node *) n; } alterOwnerStmt(A) ::= ALTER OPERATOR operator_with_argtypes(D) OWNER TO roleSpec(G). { alterOwnerStmt *n = makeNode(alterOwnerStmt); n->objectType = OBJECT_OPERATOR; n->object = (Node *) D; n->newowner = G; A = (Node *) n; } alterOwnerStmt(A) ::= ALTER OPERATOR CLASS any_name(E) USING name(G) OWNER TO roleSpec(J). { alterOwnerStmt *n = makeNode(alterOwnerStmt); n->objectType = OBJECT_OPCLASS; n->object = (Node *) lcons(makeString(G), E); n->newowner = J; A = (Node *) n; } alterOwnerStmt(A) ::= ALTER OPERATOR FAMILY any_name(E) USING name(G) OWNER TO roleSpec(J). { alterOwnerStmt *n = makeNode(alterOwnerStmt); n->objectType = OBJECT_OPFAMILY; n->object = (Node *) lcons(makeString(G), E); n->newowner = J; A = (Node *) n; } alterOwnerStmt(A) ::= ALTER PROCEDURE function_with_argtypes(D) OWNER TO roleSpec(G). { alterOwnerStmt *n = makeNode(alterOwnerStmt); n->objectType = OBJECT_PROCEDURE; n->object = (Node *) D; n->newowner = G; A = (Node *) n; } alterOwnerStmt(A) ::= ALTER PROPERTY GRAPH qualified_name(E) OWNER TO roleSpec(H). { alterOwnerStmt *n = makeNode(alterOwnerStmt); n->objectType = OBJECT_PROPGRAPH; n->relation = E; n->newowner = H; A = (Node *) n; } alterOwnerStmt(A) ::= ALTER ROUTINE function_with_argtypes(D) OWNER TO roleSpec(G). { alterOwnerStmt *n = makeNode(alterOwnerStmt); n->objectType = OBJECT_ROUTINE; n->object = (Node *) D; n->newowner = G; A = (Node *) n; } alterOwnerStmt(A) ::= ALTER SCHEMA name(D) OWNER TO roleSpec(G). { alterOwnerStmt *n = makeNode(alterOwnerStmt); n->objectType = OBJECT_SCHEMA; n->object = (Node *) makeString(D); n->newowner = G; A = (Node *) n; } alterOwnerStmt(A) ::= ALTER TYPE_P any_name(D) OWNER TO roleSpec(G). { alterOwnerStmt *n = makeNode(alterOwnerStmt); n->objectType = OBJECT_TYPE; n->object = (Node *) D; n->newowner = G; A = (Node *) n; } alterOwnerStmt(A) ::= ALTER TABLESPACE name(D) OWNER TO roleSpec(G). { alterOwnerStmt *n = makeNode(alterOwnerStmt); n->objectType = OBJECT_TABLESPACE; n->object = (Node *) makeString(D); n->newowner = G; A = (Node *) n; } alterOwnerStmt(A) ::= ALTER STATISTICS any_name(D) OWNER TO roleSpec(G). { alterOwnerStmt *n = makeNode(alterOwnerStmt); n->objectType = OBJECT_STATISTIC_EXT; n->object = (Node *) D; n->newowner = G; A = (Node *) n; } alterOwnerStmt(A) ::= ALTER TEXT_P SEARCH DICTIONARY any_name(F) OWNER TO roleSpec(I). { alterOwnerStmt *n = makeNode(alterOwnerStmt); n->objectType = OBJECT_TSDICTIONARY; n->object = (Node *) F; n->newowner = I; A = (Node *) n; } alterOwnerStmt(A) ::= ALTER TEXT_P SEARCH CONFIGURATION any_name(F) OWNER TO roleSpec(I). { alterOwnerStmt *n = makeNode(alterOwnerStmt); n->objectType = OBJECT_TSCONFIGURATION; n->object = (Node *) F; n->newowner = I; A = (Node *) n; } alterOwnerStmt(A) ::= ALTER FOREIGN DATA_P WRAPPER name(F) OWNER TO roleSpec(I). { alterOwnerStmt *n = makeNode(alterOwnerStmt); n->objectType = OBJECT_FDW; n->object = (Node *) makeString(F); n->newowner = I; A = (Node *) n; } alterOwnerStmt(A) ::= ALTER SERVER name(D) OWNER TO roleSpec(G). { alterOwnerStmt *n = makeNode(alterOwnerStmt); n->objectType = OBJECT_FOREIGN_SERVER; n->object = (Node *) makeString(D); n->newowner = G; A = (Node *) n; } alterOwnerStmt(A) ::= ALTER EVENT TRIGGER name(E) OWNER TO roleSpec(H). { alterOwnerStmt *n = makeNode(alterOwnerStmt); n->objectType = OBJECT_EVENT_TRIGGER; n->object = (Node *) makeString(E); n->newowner = H; A = (Node *) n; } alterOwnerStmt(A) ::= ALTER PUBLICATION name(D) OWNER TO roleSpec(G). { alterOwnerStmt *n = makeNode(alterOwnerStmt); n->objectType = OBJECT_PUBLICATION; n->object = (Node *) makeString(D); n->newowner = G; A = (Node *) n; } alterOwnerStmt(A) ::= ALTER SUBSCRIPTION name(D) OWNER TO roleSpec(G). { alterOwnerStmt *n = makeNode(alterOwnerStmt); n->objectType = OBJECT_SUBSCRIPTION; n->object = (Node *) makeString(D); n->newowner = G; A = (Node *) n; } /* ----- createPublicationStmt ----- */ createPublicationStmt(A) ::= CREATE PUBLICATION name(D) opt_definition(E). { createPublicationStmt *n = makeNode(createPublicationStmt); n->pubname = D; n->options = E; A = (Node *) n; } createPublicationStmt(A) ::= CREATE PUBLICATION name(D) FOR pub_all_obj_type_list(F) opt_definition(G). { createPublicationStmt *n = makeNode(createPublicationStmt); n->pubname = D; preprocess_pub_all_objtype_list(F, &n->pubobjects, &n->for_all_tables, &n->for_all_sequences, yyscanner); n->options = G; A = (Node *) n; } createPublicationStmt(A) ::= CREATE PUBLICATION name(D) FOR pub_obj_list(F) opt_definition(G). { createPublicationStmt *n = makeNode(createPublicationStmt); n->pubname = D; n->options = G; n->pubobjects = (List *) F; preprocess_pubobj_list(n->pubobjects, yyscanner); A = (Node *) n; } /* ----- publicationObjSpec ----- */ publicationObjSpec(A) ::= TABLE relation_expr(C) opt_column_list(D) optWhereClause(E). { A = makeNode(publicationObjSpec); A->pubobjtype = PUBLICATIONOBJ_TABLE; A->pubtable = makeNode(PublicationTable); A->pubtable->relation = C; A->pubtable->columns = D; A->pubtable->whereClause = E; } publicationObjSpec(A) ::= TABLES IN_P SCHEMA colId(E). { A = makeNode(publicationObjSpec); A->pubobjtype = PUBLICATIONOBJ_TABLES_IN_SCHEMA; A->name = E; A->location = LOC(E); } publicationObjSpec(A) ::= TABLES IN_P SCHEMA CURRENT_SCHEMA. { A = makeNode(publicationObjSpec); A->pubobjtype = PUBLICATIONOBJ_TABLES_IN_CUR_SCHEMA; A->location = LOC(E); } publicationObjSpec(A) ::= colId(B) opt_column_list(C) optWhereClause(D). { A = makeNode(publicationObjSpec); A->pubobjtype = PUBLICATIONOBJ_CONTINUATION; if (C || D) { A->pubtable = makeNode(PublicationTable); A->pubtable->relation = makeRangeVar(NULL, B, LOC(B)); A->pubtable->columns = C; A->pubtable->whereClause = D; } else { A->name = B; } A->location = LOC(B); } publicationObjSpec(A) ::= colId(B) indirection(C) opt_column_list(D) optWhereClause(E). { A = makeNode(publicationObjSpec); A->pubobjtype = PUBLICATIONOBJ_CONTINUATION; A->pubtable = makeNode(PublicationTable); A->pubtable->relation = makeRangeVarFromQualifiedName(B, C, LOC(B), yyscanner); A->pubtable->columns = D; A->pubtable->whereClause = E; A->location = LOC(B); } publicationObjSpec(A) ::= extended_relation_expr(B) opt_column_list(C) optWhereClause(D). { A = makeNode(publicationObjSpec); A->pubobjtype = PUBLICATIONOBJ_CONTINUATION; A->pubtable = makeNode(PublicationTable); A->pubtable->relation = B; A->pubtable->columns = C; A->pubtable->whereClause = D; } publicationObjSpec(A) ::= CURRENT_SCHEMA. { A = makeNode(publicationObjSpec); A->pubobjtype = PUBLICATIONOBJ_CONTINUATION; A->location = LOC(B); } /* ----- pub_obj_list ----- */ pub_obj_list(A) ::= publicationObjSpec(B). { A = list_make1(B); } pub_obj_list(A) ::= pub_obj_list(B) COMMA publicationObjSpec(D). { A = lappend(B, D); } /* ----- opt_pub_except_clause ----- */ opt_pub_except_clause(A) ::= EXCEPT LPAREN TABLE pub_except_obj_list(E) RPAREN. { A = E; } opt_pub_except_clause(A) ::= . { A = NIL; } /* ----- publicationAllObjSpec ----- */ publicationAllObjSpec(A) ::= ALL TABLES opt_pub_except_clause(D). { A = makeNode(publicationAllObjSpec); A->pubobjtype = PUBLICATION_ALL_TABLES; A->except_tables = D; A->location = LOC(B); } publicationAllObjSpec(A) ::= ALL SEQUENCES. { A = makeNode(publicationAllObjSpec); A->pubobjtype = PUBLICATION_ALL_SEQUENCES; A->location = LOC(B); } /* ----- pub_all_obj_type_list ----- */ pub_all_obj_type_list(A) ::= publicationAllObjSpec(B). { A = list_make1(B); } pub_all_obj_type_list(A) ::= pub_all_obj_type_list(B) COMMA publicationAllObjSpec(D). { A = lappend(B, D); } /* ----- publicationExceptObjSpec ----- */ publicationExceptObjSpec(A) ::= relation_expr(B). { A = makeNode(publicationObjSpec); A->pubobjtype = PUBLICATIONOBJ_EXCEPT_TABLE; A->pubtable = makeNode(PublicationTable); A->pubtable->except = true; A->pubtable->relation = B; A->location = LOC(B); } /* ----- pub_except_obj_list ----- */ pub_except_obj_list(A) ::= publicationExceptObjSpec(B). { A = list_make1(B); } pub_except_obj_list(A) ::= pub_except_obj_list(B) COMMA opt_table(D) publicationExceptObjSpec(E). { A = lappend(B, E); } /* ----- alterPublicationStmt ----- */ alterPublicationStmt(A) ::= ALTER PUBLICATION name(D) SET definition(F). { alterPublicationStmt *n = makeNode(alterPublicationStmt); n->pubname = D; n->options = F; n->for_all_tables = false; A = (Node *) n; } alterPublicationStmt(A) ::= ALTER PUBLICATION name(D) ADD_P pub_obj_list(F). { alterPublicationStmt *n = makeNode(alterPublicationStmt); n->pubname = D; n->pubobjects = F; preprocess_pubobj_list(n->pubobjects, yyscanner); n->action = AP_AddObjects; n->for_all_tables = false; A = (Node *) n; } alterPublicationStmt(A) ::= ALTER PUBLICATION name(D) SET pub_obj_list(F). { alterPublicationStmt *n = makeNode(alterPublicationStmt); n->pubname = D; n->pubobjects = F; preprocess_pubobj_list(n->pubobjects, yyscanner); n->action = AP_SetObjects; n->for_all_tables = false; A = (Node *) n; } alterPublicationStmt(A) ::= ALTER PUBLICATION name(D) SET pub_all_obj_type_list(F). { alterPublicationStmt *n = makeNode(alterPublicationStmt); n->pubname = D; n->action = AP_SetObjects; preprocess_pub_all_objtype_list(F, &n->pubobjects, &n->for_all_tables, &n->for_all_sequences, yyscanner); A = (Node *) n; } alterPublicationStmt(A) ::= ALTER PUBLICATION name(D) DROP pub_obj_list(F). { alterPublicationStmt *n = makeNode(alterPublicationStmt); n->pubname = D; n->pubobjects = F; preprocess_pubobj_list(n->pubobjects, yyscanner); n->action = AP_DropObjects; n->for_all_tables = false; A = (Node *) n; } /* ----- createSubscriptionStmt ----- */ createSubscriptionStmt(A) ::= CREATE SUBSCRIPTION name(D) CONNECTION sconst(F) PUBLICATION name_list(H) opt_definition(I). { createSubscriptionStmt *n = makeNode(createSubscriptionStmt); n->subname = D; n->conninfo = F; n->publication = H; n->options = I; A = (Node *) n; } createSubscriptionStmt(A) ::= CREATE SUBSCRIPTION name(D) SERVER name(F) PUBLICATION name_list(H) opt_definition(I). { createSubscriptionStmt *n = makeNode(createSubscriptionStmt); n->subname = D; n->servername = F; n->publication = H; n->options = I; A = (Node *) n; } /* ----- alterSubscriptionStmt ----- */ alterSubscriptionStmt(A) ::= ALTER SUBSCRIPTION name(D) SET definition(F). { alterSubscriptionStmt *n = makeNode(alterSubscriptionStmt); n->kind = ALTER_SUBSCRIPTION_OPTIONS; n->subname = D; n->options = F; A = (Node *) n; } alterSubscriptionStmt(A) ::= ALTER SUBSCRIPTION name(D) CONNECTION sconst(F). { alterSubscriptionStmt *n = makeNode(alterSubscriptionStmt); n->kind = ALTER_SUBSCRIPTION_CONNECTION; n->subname = D; n->conninfo = F; A = (Node *) n; } alterSubscriptionStmt(A) ::= ALTER SUBSCRIPTION name(D) SERVER name(F). { alterSubscriptionStmt *n = makeNode(alterSubscriptionStmt); n->kind = ALTER_SUBSCRIPTION_SERVER; n->subname = D; n->servername = F; A = (Node *) n; } alterSubscriptionStmt(A) ::= ALTER SUBSCRIPTION name(D) REFRESH PUBLICATION opt_definition(G). { alterSubscriptionStmt *n = makeNode(alterSubscriptionStmt); n->kind = ALTER_SUBSCRIPTION_REFRESH_PUBLICATION; n->subname = D; n->options = G; A = (Node *) n; } alterSubscriptionStmt(A) ::= ALTER SUBSCRIPTION name(D) REFRESH SEQUENCES. { alterSubscriptionStmt *n = makeNode(alterSubscriptionStmt); n->kind = ALTER_SUBSCRIPTION_REFRESH_SEQUENCES; n->subname = D; A = (Node *) n; } alterSubscriptionStmt(A) ::= ALTER SUBSCRIPTION name(D) ADD_P PUBLICATION name_list(G) opt_definition(H). { alterSubscriptionStmt *n = makeNode(alterSubscriptionStmt); n->kind = ALTER_SUBSCRIPTION_ADD_PUBLICATION; n->subname = D; n->publication = G; n->options = H; A = (Node *) n; } alterSubscriptionStmt(A) ::= ALTER SUBSCRIPTION name(D) DROP PUBLICATION name_list(G) opt_definition(H). { alterSubscriptionStmt *n = makeNode(alterSubscriptionStmt); n->kind = ALTER_SUBSCRIPTION_DROP_PUBLICATION; n->subname = D; n->publication = G; n->options = H; A = (Node *) n; } alterSubscriptionStmt(A) ::= ALTER SUBSCRIPTION name(D) SET PUBLICATION name_list(G) opt_definition(H). { alterSubscriptionStmt *n = makeNode(alterSubscriptionStmt); n->kind = ALTER_SUBSCRIPTION_SET_PUBLICATION; n->subname = D; n->publication = G; n->options = H; A = (Node *) n; } alterSubscriptionStmt(A) ::= ALTER SUBSCRIPTION name(D) ENABLE_P. { alterSubscriptionStmt *n = makeNode(alterSubscriptionStmt); n->kind = ALTER_SUBSCRIPTION_ENABLED; n->subname = D; n->options = list_make1(makeDefElem("enabled", (Node *) makeBoolean(true), LOC(B))); A = (Node *) n; } alterSubscriptionStmt(A) ::= ALTER SUBSCRIPTION name(D) DISABLE_P. { alterSubscriptionStmt *n = makeNode(alterSubscriptionStmt); n->kind = ALTER_SUBSCRIPTION_ENABLED; n->subname = D; n->options = list_make1(makeDefElem("enabled", (Node *) makeBoolean(false), LOC(B))); A = (Node *) n; } alterSubscriptionStmt(A) ::= ALTER SUBSCRIPTION name(D) SKIP definition(F). { alterSubscriptionStmt *n = makeNode(alterSubscriptionStmt); n->kind = ALTER_SUBSCRIPTION_SKIP; n->subname = D; n->options = F; A = (Node *) n; } /* ----- dropSubscriptionStmt ----- */ dropSubscriptionStmt(A) ::= DROP SUBSCRIPTION name(D) opt_drop_behavior(E). { dropSubscriptionStmt *n = makeNode(dropSubscriptionStmt); n->subname = D; n->missing_ok = false; n->behavior = E; A = (Node *) n; } dropSubscriptionStmt(A) ::= DROP SUBSCRIPTION IF_P EXISTS name(F) opt_drop_behavior(G). { dropSubscriptionStmt *n = makeNode(dropSubscriptionStmt); n->subname = F; n->missing_ok = true; n->behavior = G; A = (Node *) n; } /* ----- ruleStmt ----- */ ruleStmt(A) ::= CREATE opt_or_replace(C) RULE name(E) AS ON event(H) TO qualified_name(J) where_clause(K) DO opt_instead(M) ruleActionList(N). { ruleStmt *n = makeNode(ruleStmt); n->replace = C; n->relation = J; n->rulename = E; n->whereClause = K; n->event = H; n->instead = M; n->actions = N; A = (Node *) n; } /* ----- ruleActionList ----- */ ruleActionList(A) ::= NOTHING. { A = NIL; } ruleActionList(A) ::= ruleActionStmt(B). { A = list_make1(B); } ruleActionList(A) ::= LPAREN ruleActionMulti(C) RPAREN. { A = C; } /* ----- ruleActionMulti ----- */ ruleActionMulti(A) ::= ruleActionMulti(B) SEMICOLON ruleActionStmtOrEmpty(D). { if (D != NULL) A = lappend(B, D); else A = B; } ruleActionMulti(A) ::= ruleActionStmtOrEmpty(B). { if (B != NULL) A = list_make1(B); else A = NIL; } /* ----- ruleActionStmt ----- */ ruleActionStmt(A) ::= selectStmt(B). ruleActionStmt(A) ::= insertStmt(B). ruleActionStmt(A) ::= updateStmt(B). ruleActionStmt(A) ::= deleteStmt(B). ruleActionStmt(A) ::= notifyStmt(B). /* ----- ruleActionStmtOrEmpty ----- */ ruleActionStmtOrEmpty(A) ::= ruleActionStmt(B). { A = B; } ruleActionStmtOrEmpty(A) ::= . { A = NULL; } /* ----- event ----- */ event(A) ::= SELECT. { A = CMD_SELECT; } event(A) ::= UPDATE. { A = CMD_UPDATE; } event(A) ::= DELETE_P. { A = CMD_DELETE; } event(A) ::= INSERT. { A = CMD_INSERT; } /* ----- opt_instead ----- */ opt_instead(A) ::= INSTEAD. { A = true; } opt_instead(A) ::= ALSO. { A = false; } opt_instead(A) ::= . { A = false; } /* ----- notifyStmt ----- */ notifyStmt(A) ::= NOTIFY colId(C) notify_payload(D). { notifyStmt *n = makeNode(notifyStmt); n->conditionname = C; n->payload = D; A = (Node *) n; } /* ----- notify_payload ----- */ notify_payload(A) ::= COMMA sconst(C). { A = C; } notify_payload(A) ::= . { A = NULL; } /* ----- listenStmt ----- */ listenStmt(A) ::= LISTEN colId(C). { listenStmt *n = makeNode(listenStmt); n->conditionname = C; A = (Node *) n; } /* ----- unlistenStmt ----- */ unlistenStmt(A) ::= UNLISTEN colId(C). { unlistenStmt *n = makeNode(unlistenStmt); n->conditionname = C; A = (Node *) n; } unlistenStmt(A) ::= UNLISTEN STAR. { unlistenStmt *n = makeNode(unlistenStmt); n->conditionname = NULL; A = (Node *) n; } /* ----- transactionStmt ----- */ transactionStmt(A) ::= ABORT_P opt_transaction(C) opt_transaction_chain(D). { transactionStmt *n = makeNode(transactionStmt); n->kind = TRANS_STMT_ROLLBACK; n->options = NIL; n->chain = D; n->location = -1; A = (Node *) n; } transactionStmt(A) ::= START TRANSACTION transaction_mode_list_or_empty(D). { transactionStmt *n = makeNode(transactionStmt); n->kind = TRANS_STMT_START; n->options = D; n->location = -1; A = (Node *) n; } transactionStmt(A) ::= COMMIT opt_transaction(C) opt_transaction_chain(D). { transactionStmt *n = makeNode(transactionStmt); n->kind = TRANS_STMT_COMMIT; n->options = NIL; n->chain = D; n->location = -1; A = (Node *) n; } transactionStmt(A) ::= ROLLBACK opt_transaction(C) opt_transaction_chain(D). { transactionStmt *n = makeNode(transactionStmt); n->kind = TRANS_STMT_ROLLBACK; n->options = NIL; n->chain = D; n->location = -1; A = (Node *) n; } transactionStmt(A) ::= SAVEPOINT colId(C). { transactionStmt *n = makeNode(transactionStmt); n->kind = TRANS_STMT_SAVEPOINT; n->savepoint_name = C; n->location = LOC(C); A = (Node *) n; } transactionStmt(A) ::= RELEASE SAVEPOINT colId(D). { transactionStmt *n = makeNode(transactionStmt); n->kind = TRANS_STMT_RELEASE; n->savepoint_name = D; n->location = LOC(D); A = (Node *) n; } transactionStmt(A) ::= RELEASE colId(C). { transactionStmt *n = makeNode(transactionStmt); n->kind = TRANS_STMT_RELEASE; n->savepoint_name = C; n->location = LOC(C); A = (Node *) n; } transactionStmt(A) ::= ROLLBACK opt_transaction(C) TO SAVEPOINT colId(F). { transactionStmt *n = makeNode(transactionStmt); n->kind = TRANS_STMT_ROLLBACK_TO; n->savepoint_name = F; n->location = LOC(F); A = (Node *) n; } transactionStmt(A) ::= ROLLBACK opt_transaction(C) TO colId(E). { transactionStmt *n = makeNode(transactionStmt); n->kind = TRANS_STMT_ROLLBACK_TO; n->savepoint_name = E; n->location = LOC(E); A = (Node *) n; } transactionStmt(A) ::= PREPARE TRANSACTION sconst(D). { transactionStmt *n = makeNode(transactionStmt); n->kind = TRANS_STMT_PREPARE; n->gid = D; n->location = LOC(D); A = (Node *) n; } transactionStmt(A) ::= COMMIT PREPARED sconst(D). { transactionStmt *n = makeNode(transactionStmt); n->kind = TRANS_STMT_COMMIT_PREPARED; n->gid = D; n->location = LOC(D); A = (Node *) n; } transactionStmt(A) ::= ROLLBACK PREPARED sconst(D). { transactionStmt *n = makeNode(transactionStmt); n->kind = TRANS_STMT_ROLLBACK_PREPARED; n->gid = D; n->location = LOC(D); A = (Node *) n; } /* ----- transactionStmtLegacy ----- */ transactionStmtLegacy(A) ::= BEGIN_P opt_transaction(C) transaction_mode_list_or_empty(D). { transactionStmt *n = makeNode(transactionStmt); n->kind = TRANS_STMT_BEGIN; n->options = D; n->location = -1; A = (Node *) n; } transactionStmtLegacy(A) ::= END_P opt_transaction(C) opt_transaction_chain(D). { transactionStmt *n = makeNode(transactionStmt); n->kind = TRANS_STMT_COMMIT; n->options = NIL; n->chain = D; n->location = -1; A = (Node *) n; } /* ----- opt_transaction ----- */ opt_transaction(A) ::= WORK. opt_transaction(A) ::= TRANSACTION. /* ----- transaction_mode_item ----- */ transaction_mode_item(A) ::= ISOLATION LEVEL iso_level(D). { A = makeDefElem("transaction_isolation", makeStringConst(D, LOC(D)), LOC(B)); } transaction_mode_item(A) ::= READ ONLY. { A = makeDefElem("transaction_read_only", makeIntConst(true, LOC(B)), LOC(B)); } transaction_mode_item(A) ::= READ WRITE. { A = makeDefElem("transaction_read_only", makeIntConst(false, LOC(B)), LOC(B)); } transaction_mode_item(A) ::= DEFERRABLE. { A = makeDefElem("transaction_deferrable", makeIntConst(true, LOC(B)), LOC(B)); } transaction_mode_item(A) ::= NOT DEFERRABLE. { A = makeDefElem("transaction_deferrable", makeIntConst(false, LOC(B)), LOC(B)); } /* ----- transaction_mode_list ----- */ transaction_mode_list(A) ::= transaction_mode_item(B). { A = list_make1(B); } transaction_mode_list(A) ::= transaction_mode_list(B) COMMA transaction_mode_item(D). { A = lappend(B, D); } transaction_mode_list(A) ::= transaction_mode_list(B) transaction_mode_item(C). { A = lappend(B, C); } /* ----- transaction_mode_list_or_empty ----- */ transaction_mode_list_or_empty(A) ::= transaction_mode_list(B). transaction_mode_list_or_empty(A) ::= . { A = NIL; } /* ----- opt_transaction_chain ----- */ opt_transaction_chain(A) ::= AND CHAIN. { A = true; } opt_transaction_chain(A) ::= AND NO CHAIN. { A = false; } opt_transaction_chain(A) ::= . { A = false; } /* ----- viewStmt ----- */ viewStmt(A) ::= CREATE optTemp(C) VIEW qualified_name(E) opt_column_list(F) opt_reloptions(G) AS selectStmt(I) opt_check_option(J). { viewStmt *n = makeNode(viewStmt); n->view = E; n->view->relpersistence = C; n->aliases = F; n->query = I; n->replace = false; n->options = G; n->withCheckOption = J; A = (Node *) n; } viewStmt(A) ::= CREATE OR REPLACE optTemp(E) VIEW qualified_name(G) opt_column_list(H) opt_reloptions(I) AS selectStmt(K) opt_check_option(L). { viewStmt *n = makeNode(viewStmt); n->view = G; n->view->relpersistence = E; n->aliases = H; n->query = K; n->replace = true; n->options = I; n->withCheckOption = L; A = (Node *) n; } viewStmt(A) ::= CREATE optTemp(C) RECURSIVE VIEW qualified_name(F) LPAREN columnList(H) RPAREN opt_reloptions(J) AS selectStmt(L) opt_check_option(M). { viewStmt *n = makeNode(viewStmt); n->view = F; n->view->relpersistence = C; n->aliases = H; n->query = makeRecursiveViewSelect(n->view->relname, n->aliases, L); n->replace = false; n->options = J; n->withCheckOption = M; if (n->withCheckOption != NO_CHECK_OPTION) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("WITH CHECK OPTION not supported on recursive views"), parser_errposition(LOC(M)))); A = (Node *) n; } viewStmt(A) ::= CREATE OR REPLACE optTemp(E) RECURSIVE VIEW qualified_name(H) LPAREN columnList(J) RPAREN opt_reloptions(L) AS selectStmt(N) opt_check_option(O). { viewStmt *n = makeNode(viewStmt); n->view = H; n->view->relpersistence = E; n->aliases = J; n->query = makeRecursiveViewSelect(n->view->relname, n->aliases, N); n->replace = true; n->options = L; n->withCheckOption = O; if (n->withCheckOption != NO_CHECK_OPTION) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("WITH CHECK OPTION not supported on recursive views"), parser_errposition(LOC(O)))); A = (Node *) n; } /* ----- opt_check_option ----- */ opt_check_option(A) ::= WITH CHECK OPTION. { A = CASCADED_CHECK_OPTION; } opt_check_option(A) ::= WITH CASCADED CHECK OPTION. { A = CASCADED_CHECK_OPTION; } opt_check_option(A) ::= WITH LOCAL CHECK OPTION. { A = LOCAL_CHECK_OPTION; } opt_check_option(A) ::= . { A = NO_CHECK_OPTION; } /* ----- loadStmt ----- */ loadStmt(A) ::= LOAD file_name(C). { loadStmt *n = makeNode(loadStmt); n->filename = C; A = (Node *) n; } /* ----- createdbStmt ----- */ createdbStmt(A) ::= CREATE DATABASE name(D) opt_with(E) createdb_opt_list(F). { createdbStmt *n = makeNode(createdbStmt); n->dbname = D; n->options = F; A = (Node *) n; } /* ----- createdb_opt_list ----- */ createdb_opt_list(A) ::= createdb_opt_items(B). { A = B; } createdb_opt_list(A) ::= . { A = NIL; } /* ----- createdb_opt_items ----- */ createdb_opt_items(A) ::= createdb_opt_item(B). { A = list_make1(B); } createdb_opt_items(A) ::= createdb_opt_items(B) createdb_opt_item(C). { A = lappend(B, C); } /* ----- createdb_opt_item ----- */ createdb_opt_item(A) ::= createdb_opt_name(B) opt_equal(C) numericOnly(D). { A = makeDefElem(B, D, LOC(B)); } createdb_opt_item(A) ::= createdb_opt_name(B) opt_equal(C) opt_boolean_or_string(D). { A = makeDefElem(B, (Node *) makeString(D), LOC(B)); } createdb_opt_item(A) ::= createdb_opt_name(B) opt_equal(C) DEFAULT. { A = makeDefElem(B, NULL, LOC(B)); } /* ----- createdb_opt_name ----- */ createdb_opt_name(A) ::= IDENT. { A = B; } createdb_opt_name(A) ::= CONNECTION LIMIT. { A = pstrdup("connection_limit"); } createdb_opt_name(A) ::= ENCODING. { A = pstrdup(B); } createdb_opt_name(A) ::= LOCATION. { A = pstrdup(B); } createdb_opt_name(A) ::= OWNER. { A = pstrdup(B); } createdb_opt_name(A) ::= TABLESPACE. { A = pstrdup(B); } createdb_opt_name(A) ::= TEMPLATE. { A = pstrdup(B); } /* ----- opt_equal ----- */ opt_equal(A) ::= EQ. /* ----- alterDatabaseStmt ----- */ alterDatabaseStmt(A) ::= ALTER DATABASE name(D) WITH createdb_opt_list(F). { alterDatabaseStmt *n = makeNode(alterDatabaseStmt); n->dbname = D; n->options = F; A = (Node *) n; } alterDatabaseStmt(A) ::= ALTER DATABASE name(D) createdb_opt_list(E). { alterDatabaseStmt *n = makeNode(alterDatabaseStmt); n->dbname = D; n->options = E; A = (Node *) n; } alterDatabaseStmt(A) ::= ALTER DATABASE name(D) SET TABLESPACE name(G). { alterDatabaseStmt *n = makeNode(alterDatabaseStmt); n->dbname = D; n->options = list_make1(makeDefElem("tablespace", (Node *) makeString(G), LOC(G))); A = (Node *) n; } alterDatabaseStmt(A) ::= ALTER DATABASE name(D) REFRESH COLLATION VERSION_P. { AlterDatabaseRefreshCollStmt *n = makeNode(AlterDatabaseRefreshCollStmt); n->dbname = D; A = (Node *) n; } /* ----- alterDatabaseSetStmt ----- */ alterDatabaseSetStmt(A) ::= ALTER DATABASE name(D) setResetClause(E). { alterDatabaseSetStmt *n = makeNode(alterDatabaseSetStmt); n->dbname = D; n->setstmt = E; A = (Node *) n; } /* ----- dropdbStmt ----- */ dropdbStmt(A) ::= DROP DATABASE name(D). { dropdbStmt *n = makeNode(dropdbStmt); n->dbname = D; n->missing_ok = false; n->options = NULL; A = (Node *) n; } dropdbStmt(A) ::= DROP DATABASE IF_P EXISTS name(F). { dropdbStmt *n = makeNode(dropdbStmt); n->dbname = F; n->missing_ok = true; n->options = NULL; A = (Node *) n; } dropdbStmt(A) ::= DROP DATABASE name(D) opt_with(E) LPAREN drop_option_list(G) RPAREN. { dropdbStmt *n = makeNode(dropdbStmt); n->dbname = D; n->missing_ok = false; n->options = G; A = (Node *) n; } dropdbStmt(A) ::= DROP DATABASE IF_P EXISTS name(F) opt_with(G) LPAREN drop_option_list(I) RPAREN. { dropdbStmt *n = makeNode(dropdbStmt); n->dbname = F; n->missing_ok = true; n->options = I; A = (Node *) n; } /* ----- drop_option_list ----- */ drop_option_list(A) ::= drop_option(B). { A = list_make1((Node *) B); } drop_option_list(A) ::= drop_option_list(B) COMMA drop_option(D). { A = lappend(B, (Node *) D); } /* ----- drop_option ----- */ drop_option(A) ::= FORCE. { A = makeDefElem("force", NULL, LOC(B)); } /* ----- alterCollationStmt ----- */ alterCollationStmt(A) ::= ALTER COLLATION any_name(D) REFRESH VERSION_P. { alterCollationStmt *n = makeNode(alterCollationStmt); n->collname = D; A = (Node *) n; } /* ----- alterSystemStmt ----- */ alterSystemStmt(A) ::= ALTER SYSTEM_P SET generic_set(E). { alterSystemStmt *n = makeNode(alterSystemStmt); n->setstmt = E; A = (Node *) n; } alterSystemStmt(A) ::= ALTER SYSTEM_P RESET generic_reset(E). { alterSystemStmt *n = makeNode(alterSystemStmt); n->setstmt = E; A = (Node *) n; } /* ----- createDomainStmt ----- */ createDomainStmt(A) ::= CREATE DOMAIN_P any_name(D) opt_as(E) typename(F) colQualList(G). { createDomainStmt *n = makeNode(createDomainStmt); n->domainname = D; n->typeName = F; SplitColQualList(G, &n->constraints, &n->collClause, yyscanner); A = (Node *) n; } /* ----- alterDomainStmt ----- */ alterDomainStmt(A) ::= ALTER DOMAIN_P any_name(D) alter_column_default(E). { alterDomainStmt *n = makeNode(alterDomainStmt); n->subtype = AD_AlterDefault; n->typeName = D; n->def = E; A = (Node *) n; } alterDomainStmt(A) ::= ALTER DOMAIN_P any_name(D) DROP NOT NULL_P. { alterDomainStmt *n = makeNode(alterDomainStmt); n->subtype = AD_DropNotNull; n->typeName = D; A = (Node *) n; } alterDomainStmt(A) ::= ALTER DOMAIN_P any_name(D) SET NOT NULL_P. { alterDomainStmt *n = makeNode(alterDomainStmt); n->subtype = AD_SetNotNull; n->typeName = D; A = (Node *) n; } alterDomainStmt(A) ::= ALTER DOMAIN_P any_name(D) ADD_P domainConstraint(F). { alterDomainStmt *n = makeNode(alterDomainStmt); n->subtype = AD_AddConstraint; n->typeName = D; n->def = F; A = (Node *) n; } alterDomainStmt(A) ::= ALTER DOMAIN_P any_name(D) DROP CONSTRAINT name(G) opt_drop_behavior(H). { alterDomainStmt *n = makeNode(alterDomainStmt); n->subtype = AD_DropConstraint; n->typeName = D; n->name = G; n->behavior = H; n->missing_ok = false; A = (Node *) n; } alterDomainStmt(A) ::= ALTER DOMAIN_P any_name(D) DROP CONSTRAINT IF_P EXISTS name(I) opt_drop_behavior(J). { alterDomainStmt *n = makeNode(alterDomainStmt); n->subtype = AD_DropConstraint; n->typeName = D; n->name = I; n->behavior = J; n->missing_ok = true; A = (Node *) n; } alterDomainStmt(A) ::= ALTER DOMAIN_P any_name(D) VALIDATE CONSTRAINT name(G). { alterDomainStmt *n = makeNode(alterDomainStmt); n->subtype = AD_ValidateConstraint; n->typeName = D; n->name = G; A = (Node *) n; } /* ----- opt_as ----- */ opt_as(A) ::= AS. /* ----- alterTSDictionaryStmt ----- */ alterTSDictionaryStmt(A) ::= ALTER TEXT_P SEARCH DICTIONARY any_name(F) definition(G). { alterTSDictionaryStmt *n = makeNode(alterTSDictionaryStmt); n->dictname = F; n->options = G; A = (Node *) n; } /* ----- alterTSConfigurationStmt ----- */ alterTSConfigurationStmt(A) ::= ALTER TEXT_P SEARCH CONFIGURATION any_name(F) ADD_P MAPPING FOR name_list(J) any_with(K) any_name_list(L). { alterTSConfigurationStmt *n = makeNode(alterTSConfigurationStmt); n->kind = ALTER_TSCONFIG_ADD_MAPPING; n->cfgname = F; n->tokentype = J; n->dicts = L; n->override = false; n->replace = false; A = (Node *) n; } alterTSConfigurationStmt(A) ::= ALTER TEXT_P SEARCH CONFIGURATION any_name(F) ALTER MAPPING FOR name_list(J) any_with(K) any_name_list(L). { alterTSConfigurationStmt *n = makeNode(alterTSConfigurationStmt); n->kind = ALTER_TSCONFIG_ALTER_MAPPING_FOR_TOKEN; n->cfgname = F; n->tokentype = J; n->dicts = L; n->override = true; n->replace = false; A = (Node *) n; } alterTSConfigurationStmt(A) ::= ALTER TEXT_P SEARCH CONFIGURATION any_name(F) ALTER MAPPING REPLACE any_name(J) any_with(K) any_name(L). { alterTSConfigurationStmt *n = makeNode(alterTSConfigurationStmt); n->kind = ALTER_TSCONFIG_REPLACE_DICT; n->cfgname = F; n->tokentype = NIL; n->dicts = list_make2(J,L); n->override = false; n->replace = true; A = (Node *) n; } alterTSConfigurationStmt(A) ::= ALTER TEXT_P SEARCH CONFIGURATION any_name(F) ALTER MAPPING FOR name_list(J) REPLACE any_name(L) any_with(M) any_name(N). { alterTSConfigurationStmt *n = makeNode(alterTSConfigurationStmt); n->kind = ALTER_TSCONFIG_REPLACE_DICT_FOR_TOKEN; n->cfgname = F; n->tokentype = J; n->dicts = list_make2(L,N); n->override = false; n->replace = true; A = (Node *) n; } alterTSConfigurationStmt(A) ::= ALTER TEXT_P SEARCH CONFIGURATION any_name(F) DROP MAPPING FOR name_list(J). { alterTSConfigurationStmt *n = makeNode(alterTSConfigurationStmt); n->kind = ALTER_TSCONFIG_DROP_MAPPING; n->cfgname = F; n->tokentype = J; n->missing_ok = false; A = (Node *) n; } alterTSConfigurationStmt(A) ::= ALTER TEXT_P SEARCH CONFIGURATION any_name(F) DROP MAPPING IF_P EXISTS FOR name_list(L). { alterTSConfigurationStmt *n = makeNode(alterTSConfigurationStmt); n->kind = ALTER_TSCONFIG_DROP_MAPPING; n->cfgname = F; n->tokentype = L; n->missing_ok = true; A = (Node *) n; } /* ----- any_with ----- */ any_with(A) ::= WITH. any_with(A) ::= WITH_LA. /* ----- createConversionStmt ----- */ createConversionStmt(A) ::= CREATE opt_default(C) CONVERSION_P any_name(E) FOR sconst(G) TO sconst(I) FROM any_name(K). { createConversionStmt *n = makeNode(createConversionStmt); n->conversion_name = E; n->for_encoding_name = G; n->to_encoding_name = I; n->func_name = K; n->def = C; A = (Node *) n; } /* ----- repackStmt ----- */ repackStmt(A) ::= REPACK opt_utility_option_list(C) vacuum_relation(D) USING INDEX name(G). { repackStmt *n = makeNode(repackStmt); n->command = REPACK_COMMAND_REPACK; n->relation = (VacuumRelation *) D; n->indexname = G; n->usingindex = true; n->params = C; A = (Node *) n; } repackStmt(A) ::= REPACK opt_utility_option_list(C) vacuum_relation(D) opt_usingindex(E). { repackStmt *n = makeNode(repackStmt); n->command = REPACK_COMMAND_REPACK; n->relation = (VacuumRelation *) D; n->indexname = NULL; n->usingindex = E; n->params = C; A = (Node *) n; } repackStmt(A) ::= REPACK opt_utility_option_list(C) opt_usingindex(D). { repackStmt *n = makeNode(repackStmt); n->command = REPACK_COMMAND_REPACK; n->relation = NULL; n->indexname = NULL; n->usingindex = D; n->params = C; A = (Node *) n; } repackStmt(A) ::= CLUSTER LPAREN utility_option_list(D) RPAREN qualified_name(F) cluster_index_specification(G). { repackStmt *n = makeNode(repackStmt); n->command = REPACK_COMMAND_CLUSTER; n->relation = makeNode(VacuumRelation); n->relation->relation = F; n->indexname = G; n->usingindex = true; n->params = D; A = (Node *) n; } repackStmt(A) ::= CLUSTER opt_utility_option_list(C). { repackStmt *n = makeNode(repackStmt); n->command = REPACK_COMMAND_CLUSTER; n->relation = NULL; n->indexname = NULL; n->usingindex = true; n->params = C; A = (Node *) n; } repackStmt(A) ::= CLUSTER opt_verbose(C) qualified_name(D) cluster_index_specification(E). { repackStmt *n = makeNode(repackStmt); n->command = REPACK_COMMAND_CLUSTER; n->relation = makeNode(VacuumRelation); n->relation->relation = D; n->indexname = E; n->usingindex = true; if (C) n->params = list_make1(makeDefElem("verbose", NULL, LOC(C))); A = (Node *) n; } repackStmt(A) ::= CLUSTER VERBOSE. { repackStmt *n = makeNode(repackStmt); n->command = REPACK_COMMAND_CLUSTER; n->relation = NULL; n->indexname = NULL; n->usingindex = true; n->params = list_make1(makeDefElem("verbose", NULL, LOC(C))); A = (Node *) n; } repackStmt(A) ::= CLUSTER opt_verbose(C) name(D) ON qualified_name(F). { repackStmt *n = makeNode(repackStmt); n->command = REPACK_COMMAND_CLUSTER; n->relation = makeNode(VacuumRelation); n->relation->relation = F; n->indexname = D; n->usingindex = true; if (C) n->params = list_make1(makeDefElem("verbose", NULL, LOC(C))); A = (Node *) n; } /* ----- cluster_index_specification ----- */ cluster_index_specification(A) ::= USING name(C). { A = C; } cluster_index_specification(A) ::= . { A = NULL; } /* ----- vacuumStmt ----- */ vacuumStmt(A) ::= VACUUM opt_full(C) opt_freeze(D) opt_verbose(E) opt_analyze(F) opt_vacuum_relation_list(G). { vacuumStmt *n = makeNode(vacuumStmt); n->options = NIL; if (C) n->options = lappend(n->options, makeDefElem("full", NULL, LOC(C))); if (D) n->options = lappend(n->options, makeDefElem("freeze", NULL, LOC(D))); if (E) n->options = lappend(n->options, makeDefElem("verbose", NULL, LOC(E))); if (F) n->options = lappend(n->options, makeDefElem("analyze", NULL, LOC(F))); n->rels = G; n->is_vacuumcmd = true; A = (Node *) n; } vacuumStmt(A) ::= VACUUM LPAREN utility_option_list(D) RPAREN opt_vacuum_relation_list(F). { vacuumStmt *n = makeNode(vacuumStmt); n->options = D; n->rels = F; n->is_vacuumcmd = true; A = (Node *) n; } /* ----- analyzeStmt ----- */ analyzeStmt(A) ::= analyze_keyword(B) opt_utility_option_list(C) opt_vacuum_relation_list(D). { vacuumStmt *n = makeNode(vacuumStmt); n->options = C; n->rels = D; n->is_vacuumcmd = false; A = (Node *) n; } analyzeStmt(A) ::= analyze_keyword(B) VERBOSE opt_vacuum_relation_list(D). { vacuumStmt *n = makeNode(vacuumStmt); n->options = list_make1(makeDefElem("verbose", NULL, LOC(C))); n->rels = D; n->is_vacuumcmd = false; A = (Node *) n; } /* ----- analyze_keyword ----- */ analyze_keyword(A) ::= ANALYZE. analyze_keyword(A) ::= ANALYSE. /* ----- opt_analyze ----- */ opt_analyze(A) ::= analyze_keyword(B). { A = true; } opt_analyze(A) ::= . { A = false; } /* ----- opt_verbose ----- */ opt_verbose(A) ::= VERBOSE. { A = true; } opt_verbose(A) ::= . { A = false; } /* ----- opt_full ----- */ opt_full(A) ::= FULL. { A = true; } opt_full(A) ::= . { A = false; } /* ----- opt_freeze ----- */ opt_freeze(A) ::= FREEZE. { A = true; } opt_freeze(A) ::= . { A = false; } /* ----- opt_name_list ----- */ opt_name_list(A) ::= LPAREN name_list(C) RPAREN. { A = C; } opt_name_list(A) ::= . { A = NIL; } /* ----- vacuum_relation ----- */ vacuum_relation(A) ::= relation_expr(B) opt_name_list(C). { A = (Node *) makeVacuumRelation(B, InvalidOid, C); } /* ----- vacuum_relation_list ----- */ vacuum_relation_list(A) ::= vacuum_relation(B). { A = list_make1(B); } vacuum_relation_list(A) ::= vacuum_relation_list(B) COMMA vacuum_relation(D). { A = lappend(B, D); } /* ----- opt_vacuum_relation_list ----- */ opt_vacuum_relation_list(A) ::= vacuum_relation_list(B). { A = B; } opt_vacuum_relation_list(A) ::= . { A = NIL; } /* ----- explainStmt ----- */ explainStmt(A) ::= EXPLAIN explainableStmt(C). { explainStmt *n = makeNode(explainStmt); n->query = C; n->options = NIL; A = (Node *) n; } explainStmt(A) ::= EXPLAIN analyze_keyword(C) opt_verbose(D) explainableStmt(E). { explainStmt *n = makeNode(explainStmt); n->query = E; n->options = list_make1(makeDefElem("analyze", NULL, LOC(C))); if (D) n->options = lappend(n->options, makeDefElem("verbose", NULL, LOC(D))); A = (Node *) n; } explainStmt(A) ::= EXPLAIN VERBOSE explainableStmt(D). { explainStmt *n = makeNode(explainStmt); n->query = D; n->options = list_make1(makeDefElem("verbose", NULL, LOC(C))); A = (Node *) n; } explainStmt(A) ::= EXPLAIN LPAREN utility_option_list(D) RPAREN explainableStmt(F). { explainStmt *n = makeNode(explainStmt); n->query = F; n->options = D; A = (Node *) n; } /* ----- explainableStmt ----- */ explainableStmt(A) ::= selectStmt(B). explainableStmt(A) ::= insertStmt(B). explainableStmt(A) ::= updateStmt(B). explainableStmt(A) ::= deleteStmt(B). explainableStmt(A) ::= mergeStmt(B). explainableStmt(A) ::= declareCursorStmt(B). explainableStmt(A) ::= createAsStmt(B). explainableStmt(A) ::= createMatViewStmt(B). explainableStmt(A) ::= refreshMatViewStmt(B). explainableStmt(A) ::= executeStmt(B). /* ----- prepareStmt ----- */ prepareStmt(A) ::= PREPARE name(C) prep_type_clause(D) AS preparableStmt(F). { prepareStmt *n = makeNode(prepareStmt); n->name = C; n->argtypes = D; n->query = F; A = (Node *) n; } /* ----- prep_type_clause ----- */ prep_type_clause(A) ::= LPAREN type_list(C) RPAREN. { A = C; } prep_type_clause(A) ::= . { A = NIL; } /* ----- preparableStmt ----- */ preparableStmt(A) ::= selectStmt(B). preparableStmt(A) ::= insertStmt(B). preparableStmt(A) ::= updateStmt(B). preparableStmt(A) ::= deleteStmt(B). preparableStmt(A) ::= mergeStmt(B). /* ----- executeStmt ----- */ executeStmt(A) ::= EXECUTE name(C) execute_param_clause(D). { executeStmt *n = makeNode(executeStmt); n->name = C; n->params = D; A = (Node *) n; } executeStmt(A) ::= CREATE optTemp(C) TABLE create_as_target(E) AS EXECUTE name(H) execute_param_clause(I) opt_with_data(J). { CreateTableAsStmt *ctas = makeNode(CreateTableAsStmt); executeStmt *n = makeNode(executeStmt); n->name = H; n->params = I; ctas->query = (Node *) n; ctas->into = E; ctas->objtype = OBJECT_TABLE; ctas->is_select_into = false; ctas->if_not_exists = false; E->rel->relpersistence = C; E->skipData = !(J); A = (Node *) ctas; } executeStmt(A) ::= CREATE optTemp(C) TABLE IF_P NOT EXISTS create_as_target(H) AS EXECUTE name(K) execute_param_clause(L) opt_with_data(M). { CreateTableAsStmt *ctas = makeNode(CreateTableAsStmt); executeStmt *n = makeNode(executeStmt); n->name = K; n->params = L; ctas->query = (Node *) n; ctas->into = H; ctas->objtype = OBJECT_TABLE; ctas->is_select_into = false; ctas->if_not_exists = true; H->rel->relpersistence = C; H->skipData = !(M); A = (Node *) ctas; } /* ----- execute_param_clause ----- */ execute_param_clause(A) ::= LPAREN expr_list(C) RPAREN. { A = C; } execute_param_clause(A) ::= . { A = NIL; } /* ----- deallocateStmt ----- */ deallocateStmt(A) ::= DEALLOCATE name(C). { deallocateStmt *n = makeNode(deallocateStmt); n->name = C; n->isall = false; n->location = LOC(C); A = (Node *) n; } deallocateStmt(A) ::= DEALLOCATE PREPARE name(D). { deallocateStmt *n = makeNode(deallocateStmt); n->name = D; n->isall = false; n->location = LOC(D); A = (Node *) n; } deallocateStmt(A) ::= DEALLOCATE ALL. { deallocateStmt *n = makeNode(deallocateStmt); n->name = NULL; n->isall = true; n->location = -1; A = (Node *) n; } deallocateStmt(A) ::= DEALLOCATE PREPARE ALL. { deallocateStmt *n = makeNode(deallocateStmt); n->name = NULL; n->isall = true; n->location = -1; A = (Node *) n; } /* ----- insertStmt ----- */ insertStmt(A) ::= opt_with_clause(B) INSERT INTO insert_target(E) insert_rest(F) opt_on_conflict(G) returning_clause(H). { F->relation = E; F->onConflictClause = G; F->returningClause = H; F->withClause = B; A = (Node *) F; } /* ----- insert_target ----- */ insert_target(A) ::= qualified_name(B). { A = B; } insert_target(A) ::= qualified_name(B) AS colId(D). { B->alias = makeAlias(D, NIL); A = B; } /* ----- insert_rest ----- */ insert_rest(A) ::= selectStmt(B). { A = makeNode(insertStmt); A->cols = NIL; A->selectStmt = B; } insert_rest(A) ::= OVERRIDING override_kind(C) VALUE_P selectStmt(E). { A = makeNode(insertStmt); A->cols = NIL; A->override = C; A->selectStmt = E; } insert_rest(A) ::= LPAREN insert_column_list(C) RPAREN selectStmt(E). { A = makeNode(insertStmt); A->cols = C; A->selectStmt = E; } insert_rest(A) ::= LPAREN insert_column_list(C) RPAREN OVERRIDING override_kind(F) VALUE_P selectStmt(H). { A = makeNode(insertStmt); A->cols = C; A->override = F; A->selectStmt = H; } insert_rest(A) ::= DEFAULT VALUES. { A = makeNode(insertStmt); A->cols = NIL; A->selectStmt = NULL; } /* ----- override_kind ----- */ override_kind(A) ::= USER. { A = OVERRIDING_USER_VALUE; } override_kind(A) ::= SYSTEM_P. { A = OVERRIDING_SYSTEM_VALUE; } /* ----- insert_column_list ----- */ insert_column_list(A) ::= insert_column_item(B). { A = list_make1(B); } insert_column_list(A) ::= insert_column_list(B) COMMA insert_column_item(D). { A = lappend(B, D); } /* ----- insert_column_item ----- */ insert_column_item(A) ::= colId(B) opt_indirection(C). { A = makeNode(ResTarget); A->name = B; A->indirection = check_indirection(C, yyscanner); A->val = NULL; A->location = LOC(B); } /* ----- opt_on_conflict ----- */ opt_on_conflict(A) ::= ON CONFLICT opt_conf_expr(D) DO SELECT opt_for_locking_strength(G) where_clause(H). { A = makeNode(OnConflictClause); A->action = ONCONFLICT_SELECT; A->infer = D; A->targetList = NIL; A->lockStrength = G; A->whereClause = H; A->location = LOC(B); } opt_on_conflict(A) ::= ON CONFLICT opt_conf_expr(D) DO UPDATE SET set_clause_list(H) where_clause(I). { A = makeNode(OnConflictClause); A->action = ONCONFLICT_UPDATE; A->infer = D; A->targetList = H; A->lockStrength = LCS_NONE; A->whereClause = I; A->location = LOC(B); } opt_on_conflict(A) ::= ON CONFLICT opt_conf_expr(D) DO NOTHING. { A = makeNode(OnConflictClause); A->action = ONCONFLICT_NOTHING; A->infer = D; A->targetList = NIL; A->lockStrength = LCS_NONE; A->whereClause = NULL; A->location = LOC(B); } opt_on_conflict(A) ::= . { A = NULL; } /* ----- opt_conf_expr ----- */ opt_conf_expr(A) ::= LPAREN index_params(C) RPAREN where_clause(E). { A = makeNode(InferClause); A->indexElems = C; A->whereClause = E; A->conname = NULL; A->location = LOC(B); } opt_conf_expr(A) ::= ON CONSTRAINT name(D). { A = makeNode(InferClause); A->indexElems = NIL; A->whereClause = NULL; A->conname = D; A->location = LOC(B); } opt_conf_expr(A) ::= . { A = NULL; } /* ----- returning_clause ----- */ returning_clause(A) ::= RETURNING returning_with_clause(C) target_list(D). { ReturningClause *n = makeNode(ReturningClause); n->options = C; n->exprs = D; A = n; } returning_clause(A) ::= . { A = NULL; } /* ----- returning_with_clause ----- */ returning_with_clause(A) ::= WITH LPAREN returning_options(D) RPAREN. { A = D; } returning_with_clause(A) ::= . { A = NIL; } /* ----- returning_options ----- */ returning_options(A) ::= returning_option(B). { A = list_make1(B); } returning_options(A) ::= returning_options(B) COMMA returning_option(D). { A = lappend(B, D); } /* ----- returning_option ----- */ returning_option(A) ::= returning_option_kind(B) AS colId(D). { ReturningOption *n = makeNode(ReturningOption); n->option = B; n->value = D; n->location = LOC(B); A = (Node *) n; } /* ----- returning_option_kind ----- */ returning_option_kind(A) ::= OLD. { A = RETURNING_OPTION_OLD; } returning_option_kind(A) ::= NEW. { A = RETURNING_OPTION_NEW; } /* ----- deleteStmt ----- */ deleteStmt(A) ::= opt_with_clause(B) DELETE_P FROM relation_expr_opt_alias(E) using_clause(F) where_or_current_clause(G) returning_clause(H). { deleteStmt *n = makeNode(deleteStmt); n->relation = E; n->usingClause = F; n->whereClause = G; n->returningClause = H; n->withClause = B; A = (Node *) n; } /* ----- using_clause ----- */ using_clause(A) ::= USING from_list(C). { A = C; } using_clause(A) ::= . { A = NIL; } /* ----- lockStmt ----- */ lockStmt(A) ::= LOCK_P opt_table(C) relation_expr_list(D) opt_lock(E) opt_nowait(F). { lockStmt *n = makeNode(lockStmt); n->relations = D; n->mode = E; n->nowait = F; A = (Node *) n; } /* ----- opt_lock ----- */ opt_lock(A) ::= IN_P lock_type(C) MODE. { A = C; } opt_lock(A) ::= . { A = AccessExclusiveLock; } /* ----- lock_type ----- */ lock_type(A) ::= ACCESS SHARE. { A = AccessShareLock; } lock_type(A) ::= ROW SHARE. { A = RowShareLock; } lock_type(A) ::= ROW EXCLUSIVE. { A = RowExclusiveLock; } lock_type(A) ::= SHARE UPDATE EXCLUSIVE. { A = ShareUpdateExclusiveLock; } lock_type(A) ::= SHARE. { A = ShareLock; } lock_type(A) ::= SHARE ROW EXCLUSIVE. { A = ShareRowExclusiveLock; } lock_type(A) ::= EXCLUSIVE. { A = ExclusiveLock; } lock_type(A) ::= ACCESS EXCLUSIVE. { A = AccessExclusiveLock; } /* ----- opt_nowait ----- */ opt_nowait(A) ::= NOWAIT. { A = true; } opt_nowait(A) ::= . { A = false; } /* ----- opt_nowait_or_skip ----- */ opt_nowait_or_skip(A) ::= NOWAIT. { A = LockWaitError; } opt_nowait_or_skip(A) ::= SKIP LOCKED. { A = LockWaitSkip; } opt_nowait_or_skip(A) ::= . { A = LockWaitBlock; } /* ----- updateStmt ----- */ updateStmt(A) ::= opt_with_clause(B) UPDATE relation_expr_opt_alias(D) SET set_clause_list(F) from_clause(G) where_or_current_clause(H) returning_clause(I). { updateStmt *n = makeNode(updateStmt); n->relation = D; n->targetList = F; n->fromClause = G; n->whereClause = H; n->returningClause = I; n->withClause = B; A = (Node *) n; } /* ----- set_clause_list ----- */ set_clause_list(A) ::= set_clause(B). { A = B; } set_clause_list(A) ::= set_clause_list(B) COMMA set_clause(D). { A = list_concat(B,D); } /* ----- set_clause ----- */ set_clause(A) ::= set_target(B) EQ a_expr(D). { B->val = (Node *) D; A = list_make1(B); } set_clause(A) ::= LPAREN set_target_list(C) RPAREN EQ a_expr(F). { int ncolumns = list_length(C); int i = 1; ListCell *col_cell; foreach(col_cell, C) { ResTarget *res_col = (ResTarget *) lfirst(col_cell); MultiAssignRef *r = makeNode(MultiAssignRef); r->source = (Node *) F; r->colno = i; r->ncolumns = ncolumns; res_col->val = (Node *) r; i++; } A = C; } /* ----- set_target ----- */ set_target(A) ::= colId(B) opt_indirection(C). { A = makeNode(ResTarget); A->name = B; A->indirection = check_indirection(C, yyscanner); A->val = NULL; A->location = LOC(B); } /* ----- set_target_list ----- */ set_target_list(A) ::= set_target(B). { A = list_make1(B); } set_target_list(A) ::= set_target_list(B) COMMA set_target(D). { A = lappend(B,D); } /* ----- mergeStmt ----- */ mergeStmt(A) ::= opt_with_clause(B) MERGE INTO relation_expr_opt_alias(E) USING table_ref(G) ON a_expr(I) merge_when_list(J) returning_clause(K). { mergeStmt *m = makeNode(mergeStmt); m->withClause = B; m->relation = E; m->sourceRelation = G; m->joinCondition = I; m->mergeWhenClauses = J; m->returningClause = K; A = (Node *) m; } /* ----- merge_when_list ----- */ merge_when_list(A) ::= merge_when_clause(B). { A = list_make1(B); } merge_when_list(A) ::= merge_when_list(B) merge_when_clause(C). { A = lappend(B,C); } /* ----- merge_when_clause ----- */ merge_when_clause(A) ::= merge_when_tgt_matched(B) opt_merge_when_condition(C) THEN merge_update(E). { E->matchKind = B; E->condition = C; A = (Node *) E; } merge_when_clause(A) ::= merge_when_tgt_matched(B) opt_merge_when_condition(C) THEN merge_delete(E). { E->matchKind = B; E->condition = C; A = (Node *) E; } merge_when_clause(A) ::= merge_when_tgt_not_matched(B) opt_merge_when_condition(C) THEN merge_insert(E). { E->matchKind = B; E->condition = C; A = (Node *) E; } merge_when_clause(A) ::= merge_when_tgt_matched(B) opt_merge_when_condition(C) THEN DO NOTHING. { MergeWhenClause *m = makeNode(MergeWhenClause); m->matchKind = B; m->commandType = CMD_NOTHING; m->condition = C; A = (Node *) m; } merge_when_clause(A) ::= merge_when_tgt_not_matched(B) opt_merge_when_condition(C) THEN DO NOTHING. { MergeWhenClause *m = makeNode(MergeWhenClause); m->matchKind = B; m->commandType = CMD_NOTHING; m->condition = C; A = (Node *) m; } /* ----- merge_when_tgt_matched ----- */ merge_when_tgt_matched(A) ::= WHEN MATCHED. { A = MERGE_WHEN_MATCHED; } merge_when_tgt_matched(A) ::= WHEN NOT MATCHED BY SOURCE. { A = MERGE_WHEN_NOT_MATCHED_BY_SOURCE; } /* ----- merge_when_tgt_not_matched ----- */ merge_when_tgt_not_matched(A) ::= WHEN NOT MATCHED. { A = MERGE_WHEN_NOT_MATCHED_BY_TARGET; } merge_when_tgt_not_matched(A) ::= WHEN NOT MATCHED BY TARGET. { A = MERGE_WHEN_NOT_MATCHED_BY_TARGET; } /* ----- opt_merge_when_condition ----- */ opt_merge_when_condition(A) ::= AND a_expr(C). { A = C; } opt_merge_when_condition(A) ::= . { A = NULL; } /* ----- merge_update ----- */ merge_update(A) ::= UPDATE SET set_clause_list(D). { MergeWhenClause *n = makeNode(MergeWhenClause); n->commandType = CMD_UPDATE; n->override = OVERRIDING_NOT_SET; n->targetList = D; n->values = NIL; A = n; } /* ----- merge_delete ----- */ merge_delete(A) ::= DELETE_P. { MergeWhenClause *n = makeNode(MergeWhenClause); n->commandType = CMD_DELETE; n->override = OVERRIDING_NOT_SET; n->targetList = NIL; n->values = NIL; A = n; } /* ----- merge_insert ----- */ merge_insert(A) ::= INSERT merge_values_clause(C). { MergeWhenClause *n = makeNode(MergeWhenClause); n->commandType = CMD_INSERT; n->override = OVERRIDING_NOT_SET; n->targetList = NIL; n->values = C; A = n; } merge_insert(A) ::= INSERT OVERRIDING override_kind(D) VALUE_P merge_values_clause(F). { MergeWhenClause *n = makeNode(MergeWhenClause); n->commandType = CMD_INSERT; n->override = D; n->targetList = NIL; n->values = F; A = n; } merge_insert(A) ::= INSERT LPAREN insert_column_list(D) RPAREN merge_values_clause(F). { MergeWhenClause *n = makeNode(MergeWhenClause); n->commandType = CMD_INSERT; n->override = OVERRIDING_NOT_SET; n->targetList = D; n->values = F; A = n; } merge_insert(A) ::= INSERT LPAREN insert_column_list(D) RPAREN OVERRIDING override_kind(G) VALUE_P merge_values_clause(I). { MergeWhenClause *n = makeNode(MergeWhenClause); n->commandType = CMD_INSERT; n->override = G; n->targetList = D; n->values = I; A = n; } merge_insert(A) ::= INSERT DEFAULT VALUES. { MergeWhenClause *n = makeNode(MergeWhenClause); n->commandType = CMD_INSERT; n->override = OVERRIDING_NOT_SET; n->targetList = NIL; n->values = NIL; A = n; } /* ----- merge_values_clause ----- */ merge_values_clause(A) ::= VALUES LPAREN expr_list(D) RPAREN. { A = D; } /* ----- declareCursorStmt ----- */ declareCursorStmt(A) ::= DECLARE cursor_name(C) cursor_options(D) CURSOR opt_hold(F) FOR selectStmt(H). { declareCursorStmt *n = makeNode(declareCursorStmt); n->portalname = C; n->options = D | F | CURSOR_OPT_FAST_PLAN; n->query = H; A = (Node *) n; } /* ----- cursor_name ----- */ cursor_name(A) ::= name(B). { A = B; } /* ----- cursor_options ----- */ cursor_options(A) ::= . { A = 0; } cursor_options(A) ::= cursor_options(B) NO SCROLL. { A = B | CURSOR_OPT_NO_SCROLL; } cursor_options(A) ::= cursor_options(B) SCROLL. { A = B | CURSOR_OPT_SCROLL; } cursor_options(A) ::= cursor_options(B) BINARY. { A = B | CURSOR_OPT_BINARY; } cursor_options(A) ::= cursor_options(B) ASENSITIVE. { A = B | CURSOR_OPT_ASENSITIVE; } cursor_options(A) ::= cursor_options(B) INSENSITIVE. { A = B | CURSOR_OPT_INSENSITIVE; } /* ----- opt_hold ----- */ opt_hold(A) ::= . { A = 0; } opt_hold(A) ::= WITH HOLD. { A = CURSOR_OPT_HOLD; } opt_hold(A) ::= WITHOUT HOLD. { A = 0; } /* ----- selectStmt ----- */ selectStmt(A) ::= select_no_parens(B). [UMINUS] selectStmt(A) ::= select_with_parens(B). [UMINUS] /* ----- select_with_parens ----- */ select_with_parens(A) ::= LPAREN select_no_parens(C) RPAREN. { A = C; } select_with_parens(A) ::= LPAREN select_with_parens(C) RPAREN. { A = C; } /* ----- select_no_parens ----- */ select_no_parens(A) ::= simple_select(B). { A = B; } select_no_parens(A) ::= select_clause(B) sort_clause(C). { insertSelectOptions((selectStmt *) B, C, NIL, NULL, NULL, yyscanner); A = B; } select_no_parens(A) ::= select_clause(B) opt_sort_clause(C) for_locking_clause(D) opt_select_limit(E). { insertSelectOptions((selectStmt *) B, C, D, E, NULL, yyscanner); A = B; } select_no_parens(A) ::= select_clause(B) opt_sort_clause(C) select_limit(D) opt_for_locking_clause(E). { insertSelectOptions((selectStmt *) B, C, E, D, NULL, yyscanner); A = B; } select_no_parens(A) ::= with_clause(B) select_clause(C). { insertSelectOptions((selectStmt *) C, NULL, NIL, NULL, B, yyscanner); A = C; } select_no_parens(A) ::= with_clause(B) select_clause(C) sort_clause(D). { insertSelectOptions((selectStmt *) C, D, NIL, NULL, B, yyscanner); A = C; } select_no_parens(A) ::= with_clause(B) select_clause(C) opt_sort_clause(D) for_locking_clause(E) opt_select_limit(F). { insertSelectOptions((selectStmt *) C, D, E, F, B, yyscanner); A = C; } select_no_parens(A) ::= with_clause(B) select_clause(C) opt_sort_clause(D) select_limit(E) opt_for_locking_clause(F). { insertSelectOptions((selectStmt *) C, D, F, E, B, yyscanner); A = C; } /* ----- select_clause ----- */ select_clause(A) ::= simple_select(B). { A = B; } select_clause(A) ::= select_with_parens(B). { A = B; } /* ----- simple_select ----- */ simple_select(A) ::= SELECT opt_all_clause(C) opt_target_list(D) into_clause(E) from_clause(F) where_clause(G) group_clause(H) having_clause(I) window_clause(J). { selectStmt *n = makeNode(selectStmt); n->targetList = D; n->intoClause = E; n->fromClause = F; n->whereClause = G; n->groupClause = (H)->list; n->groupDistinct = (H)->distinct; n->groupByAll = (H)->all; n->havingClause = I; n->windowClause = J; A = (Node *) n; } simple_select(A) ::= SELECT distinct_clause(C) target_list(D) into_clause(E) from_clause(F) where_clause(G) group_clause(H) having_clause(I) window_clause(J). { selectStmt *n = makeNode(selectStmt); n->distinctClause = C; n->targetList = D; n->intoClause = E; n->fromClause = F; n->whereClause = G; n->groupClause = (H)->list; n->groupDistinct = (H)->distinct; n->groupByAll = (H)->all; n->havingClause = I; n->windowClause = J; A = (Node *) n; } simple_select(A) ::= values_clause(B). { A = B; } simple_select(A) ::= TABLE relation_expr(C). { ColumnRef *cr = makeNode(ColumnRef); ResTarget *rt = makeNode(ResTarget); selectStmt *n = makeNode(selectStmt); cr->fields = list_make1(makeNode(A_Star)); cr->location = -1; rt->name = NULL; rt->indirection = NIL; rt->val = (Node *) cr; rt->location = -1; n->targetList = list_make1(rt); n->fromClause = list_make1(C); A = (Node *) n; } simple_select(A) ::= select_clause(B) UNION set_quantifier(D) select_clause(E). { A = makeSetOp(SETOP_UNION, D == SET_QUANTIFIER_ALL, B, E); } simple_select(A) ::= select_clause(B) INTERSECT set_quantifier(D) select_clause(E). { A = makeSetOp(SETOP_INTERSECT, D == SET_QUANTIFIER_ALL, B, E); } simple_select(A) ::= select_clause(B) EXCEPT set_quantifier(D) select_clause(E). { A = makeSetOp(SETOP_EXCEPT, D == SET_QUANTIFIER_ALL, B, E); } /* ----- with_clause ----- */ with_clause(A) ::= WITH cte_list(C). { A = makeNode(WithClause); A->ctes = C; A->recursive = false; A->location = LOC(B); } with_clause(A) ::= WITH_LA cte_list(C). { A = makeNode(WithClause); A->ctes = C; A->recursive = false; A->location = LOC(B); } with_clause(A) ::= WITH RECURSIVE cte_list(D). { A = makeNode(WithClause); A->ctes = D; A->recursive = true; A->location = LOC(B); } /* ----- cte_list ----- */ cte_list(A) ::= common_table_expr(B). { A = list_make1(B); } cte_list(A) ::= cte_list(B) COMMA common_table_expr(D). { A = lappend(B, D); } /* ----- common_table_expr ----- */ common_table_expr(A) ::= name(B) opt_name_list(C) AS opt_materialized(E) LPAREN preparableStmt(G) RPAREN opt_search_clause(I) opt_cycle_clause(J). { CommonTableExpr *n = makeNode(CommonTableExpr); n->ctename = B; n->aliascolnames = C; n->ctematerialized = E; n->ctequery = G; n->search_clause = castNode(CTESearchClause, I); n->cycle_clause = castNode(CTECycleClause, J); n->location = LOC(B); A = (Node *) n; } /* ----- opt_materialized ----- */ opt_materialized(A) ::= MATERIALIZED. { A = CTEMaterializeAlways; } opt_materialized(A) ::= NOT MATERIALIZED. { A = CTEMaterializeNever; } opt_materialized(A) ::= . { A = CTEMaterializeDefault; } /* ----- opt_search_clause ----- */ opt_search_clause(A) ::= SEARCH DEPTH FIRST_P BY columnList(F) SET colId(H). { CTESearchClause *n = makeNode(CTESearchClause); n->search_col_list = F; n->search_breadth_first = false; n->search_seq_column = H; n->location = LOC(B); A = (Node *) n; } opt_search_clause(A) ::= SEARCH BREADTH FIRST_P BY columnList(F) SET colId(H). { CTESearchClause *n = makeNode(CTESearchClause); n->search_col_list = F; n->search_breadth_first = true; n->search_seq_column = H; n->location = LOC(B); A = (Node *) n; } opt_search_clause(A) ::= . { A = NULL; } /* ----- opt_cycle_clause ----- */ opt_cycle_clause(A) ::= CYCLE columnList(C) SET colId(E) TO aexprConst(G) DEFAULT aexprConst(I) USING colId(K). { CTECycleClause *n = makeNode(CTECycleClause); n->cycle_col_list = C; n->cycle_mark_column = E; n->cycle_mark_value = G; n->cycle_mark_default = I; n->cycle_path_column = K; n->location = LOC(B); A = (Node *) n; } opt_cycle_clause(A) ::= CYCLE columnList(C) SET colId(E) USING colId(G). { CTECycleClause *n = makeNode(CTECycleClause); n->cycle_col_list = C; n->cycle_mark_column = E; n->cycle_mark_value = makeBoolAConst(true, -1); n->cycle_mark_default = makeBoolAConst(false, -1); n->cycle_path_column = G; n->location = LOC(B); A = (Node *) n; } opt_cycle_clause(A) ::= . { A = NULL; } /* ----- opt_with_clause ----- */ opt_with_clause(A) ::= with_clause(B). { A = B; } opt_with_clause(A) ::= . { A = NULL; } /* ----- into_clause ----- */ into_clause(A) ::= INTO optTempTableName(C). { A = makeNode(IntoClause); A->rel = C; A->colNames = NIL; A->options = NIL; A->onCommit = ONCOMMIT_NOOP; A->tableSpaceName = NULL; A->viewQuery = NULL; A->skipData = false; } into_clause(A) ::= . { A = NULL; } /* ----- optTempTableName ----- */ optTempTableName(A) ::= TEMPORARY opt_table(C) qualified_name(D). { A = D; A->relpersistence = RELPERSISTENCE_TEMP; } optTempTableName(A) ::= TEMP opt_table(C) qualified_name(D). { A = D; A->relpersistence = RELPERSISTENCE_TEMP; } optTempTableName(A) ::= LOCAL TEMPORARY opt_table(D) qualified_name(E). { A = E; A->relpersistence = RELPERSISTENCE_TEMP; } optTempTableName(A) ::= LOCAL TEMP opt_table(D) qualified_name(E). { A = E; A->relpersistence = RELPERSISTENCE_TEMP; } optTempTableName(A) ::= GLOBAL TEMPORARY opt_table(D) qualified_name(E). { ereport(WARNING, (errmsg("GLOBAL is deprecated in temporary table creation"), parser_errposition(LOC(B)))); A = E; A->relpersistence = RELPERSISTENCE_TEMP; } optTempTableName(A) ::= GLOBAL TEMP opt_table(D) qualified_name(E). { ereport(WARNING, (errmsg("GLOBAL is deprecated in temporary table creation"), parser_errposition(LOC(B)))); A = E; A->relpersistence = RELPERSISTENCE_TEMP; } optTempTableName(A) ::= UNLOGGED opt_table(C) qualified_name(D). { A = D; A->relpersistence = RELPERSISTENCE_UNLOGGED; } optTempTableName(A) ::= TABLE qualified_name(C). { A = C; A->relpersistence = RELPERSISTENCE_PERMANENT; } optTempTableName(A) ::= qualified_name(B). { A = B; A->relpersistence = RELPERSISTENCE_PERMANENT; } /* ----- opt_table ----- */ opt_table(A) ::= TABLE. /* ----- set_quantifier ----- */ set_quantifier(A) ::= ALL. { A = SET_QUANTIFIER_ALL; } set_quantifier(A) ::= DISTINCT. { A = SET_QUANTIFIER_DISTINCT; } set_quantifier(A) ::= . { A = SET_QUANTIFIER_DEFAULT; } /* ----- distinct_clause ----- */ distinct_clause(A) ::= DISTINCT. { A = list_make1(NIL); } distinct_clause(A) ::= DISTINCT ON LPAREN expr_list(E) RPAREN. { A = E; } /* ----- opt_all_clause ----- */ opt_all_clause(A) ::= ALL. /* ----- opt_distinct_clause ----- */ opt_distinct_clause(A) ::= distinct_clause(B). { A = B; } opt_distinct_clause(A) ::= opt_all_clause(B). { A = NIL; } /* ----- opt_sort_clause ----- */ opt_sort_clause(A) ::= sort_clause(B). { A = B; } opt_sort_clause(A) ::= . { A = NIL; } /* ----- sort_clause ----- */ sort_clause(A) ::= ORDER BY sortby_list(D). { A = D; } /* ----- sortby_list ----- */ sortby_list(A) ::= sortby(B). { A = list_make1(B); } sortby_list(A) ::= sortby_list(B) COMMA sortby(D). { A = lappend(B, D); } /* ----- sortby ----- */ sortby(A) ::= a_expr(B) USING qual_all_Op(D) opt_nulls_order(E). { A = makeNode(SortBy); A->node = B; A->sortby_dir = SORTBY_USING; A->sortby_nulls = E; A->useOp = D; A->location = LOC(D); } sortby(A) ::= a_expr(B) opt_asc_desc(C) opt_nulls_order(D). { A = makeNode(SortBy); A->node = B; A->sortby_dir = C; A->sortby_nulls = D; A->useOp = NIL; A->location = -1; } /* ----- select_limit ----- */ select_limit(A) ::= limit_clause(B) offset_clause(C). { A = B; (A)->limitOffset = C; (A)->offsetLoc = LOC(C); } select_limit(A) ::= offset_clause(B) limit_clause(C). { A = C; (A)->limitOffset = B; (A)->offsetLoc = LOC(B); } select_limit(A) ::= limit_clause(B). { A = B; } select_limit(A) ::= offset_clause(B). { SelectLimit *n = palloc_object(SelectLimit); n->limitOffset = B; n->limitCount = NULL; n->limitOption = LIMIT_OPTION_COUNT; n->offsetLoc = LOC(B); n->countLoc = -1; n->optionLoc = -1; A = n; } /* ----- opt_select_limit ----- */ opt_select_limit(A) ::= select_limit(B). { A = B; } opt_select_limit(A) ::= . { A = NULL; } /* ----- limit_clause ----- */ limit_clause(A) ::= LIMIT select_limit_value(C). { SelectLimit *n = palloc_object(SelectLimit); n->limitOffset = NULL; n->limitCount = C; n->limitOption = LIMIT_OPTION_COUNT; n->offsetLoc = -1; n->countLoc = LOC(B); n->optionLoc = -1; A = n; } limit_clause(A) ::= LIMIT select_limit_value(C) COMMA select_offset_value(E). { ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("LIMIT #,# syntax is not supported"), errhint("Use separate LIMIT and OFFSET clauses."), parser_errposition(LOC(B)))); } limit_clause(A) ::= FETCH first_or_next(C) select_fetch_first_value(D) row_or_rows(E) ONLY. { SelectLimit *n = palloc_object(SelectLimit); n->limitOffset = NULL; n->limitCount = D; n->limitOption = LIMIT_OPTION_COUNT; n->offsetLoc = -1; n->countLoc = LOC(B); n->optionLoc = -1; A = n; } limit_clause(A) ::= FETCH first_or_next(C) select_fetch_first_value(D) row_or_rows(E) WITH TIES. { SelectLimit *n = palloc_object(SelectLimit); n->limitOffset = NULL; n->limitCount = D; n->limitOption = LIMIT_OPTION_WITH_TIES; n->offsetLoc = -1; n->countLoc = LOC(B); n->optionLoc = LOC(F); A = n; } limit_clause(A) ::= FETCH first_or_next(C) row_or_rows(D) ONLY. { SelectLimit *n = palloc_object(SelectLimit); n->limitOffset = NULL; n->limitCount = makeIntConst(1, -1); n->limitOption = LIMIT_OPTION_COUNT; n->offsetLoc = -1; n->countLoc = LOC(B); n->optionLoc = -1; A = n; } limit_clause(A) ::= FETCH first_or_next(C) row_or_rows(D) WITH TIES. { SelectLimit *n = palloc_object(SelectLimit); n->limitOffset = NULL; n->limitCount = makeIntConst(1, -1); n->limitOption = LIMIT_OPTION_WITH_TIES; n->offsetLoc = -1; n->countLoc = LOC(B); n->optionLoc = LOC(E); A = n; } /* ----- offset_clause ----- */ offset_clause(A) ::= OFFSET select_offset_value(C). { A = C; } offset_clause(A) ::= OFFSET select_fetch_first_value(C) row_or_rows(D). { A = C; } /* ----- select_limit_value ----- */ select_limit_value(A) ::= a_expr(B). { A = B; } select_limit_value(A) ::= ALL. { A = makeNullAConst(LOC(B)); } /* ----- select_offset_value ----- */ select_offset_value(A) ::= a_expr(B). { A = B; } /* ----- select_fetch_first_value ----- */ select_fetch_first_value(A) ::= c_expr(B). { A = B; } select_fetch_first_value(A) ::= PLUS i_or_F_const(C). { A = (Node *) makeSimpleA_Expr(AEXPR_OP, "+", NULL, C, LOC(B)); } select_fetch_first_value(A) ::= MINUS i_or_F_const(C). { A = doNegate(C, LOC(B)); } /* ----- i_or_F_const ----- */ i_or_F_const(A) ::= iconst(B). { A = makeIntConst(B,LOC(B)); } i_or_F_const(A) ::= FCONST. { A = makeFloatConst(B,LOC(B)); } /* ----- row_or_rows ----- */ row_or_rows(A) ::= ROW. { A = 0; } row_or_rows(A) ::= ROWS. { A = 0; } /* ----- first_or_next ----- */ first_or_next(A) ::= FIRST_P. { A = 0; } first_or_next(A) ::= NEXT. { A = 0; } /* ----- group_clause ----- */ group_clause(A) ::= GROUP_P BY set_quantifier(D) group_by_list(E). { GroupClause *n = palloc_object(GroupClause); n->distinct = D == SET_QUANTIFIER_DISTINCT; n->all = false; n->list = E; A = n; } group_clause(A) ::= GROUP_P BY ALL. { GroupClause *n = palloc_object(GroupClause); n->distinct = false; n->all = true; n->list = NIL; A = n; } group_clause(A) ::= . { GroupClause *n = palloc_object(GroupClause); n->distinct = false; n->all = false; n->list = NIL; A = n; } /* ----- group_by_list ----- */ group_by_list(A) ::= group_by_item(B). { A = list_make1(B); } group_by_list(A) ::= group_by_list(B) COMMA group_by_item(D). { A = lappend(B,D); } /* ----- group_by_item ----- */ group_by_item(A) ::= a_expr(B). { A = B; } group_by_item(A) ::= empty_grouping_set(B). { A = B; } group_by_item(A) ::= cube_clause(B). { A = B; } group_by_item(A) ::= rollup_clause(B). { A = B; } group_by_item(A) ::= grouping_sets_clause(B). { A = B; } /* ----- empty_grouping_set ----- */ empty_grouping_set(A) ::= LPAREN RPAREN. { A = (Node *) makeGroupingSet(GROUPING_SET_EMPTY, NIL, LOC(B)); } /* ----- rollup_clause ----- */ rollup_clause(A) ::= ROLLUP LPAREN expr_list(D) RPAREN. { A = (Node *) makeGroupingSet(GROUPING_SET_ROLLUP, D, LOC(B)); } /* ----- cube_clause ----- */ cube_clause(A) ::= CUBE LPAREN expr_list(D) RPAREN. { A = (Node *) makeGroupingSet(GROUPING_SET_CUBE, D, LOC(B)); } /* ----- grouping_sets_clause ----- */ grouping_sets_clause(A) ::= GROUPING SETS LPAREN group_by_list(E) RPAREN. { A = (Node *) makeGroupingSet(GROUPING_SET_SETS, E, LOC(B)); } /* ----- having_clause ----- */ having_clause(A) ::= HAVING a_expr(C). { A = C; } having_clause(A) ::= . { A = NULL; } /* ----- for_locking_clause ----- */ for_locking_clause(A) ::= for_locking_items(B). { A = B; } for_locking_clause(A) ::= FOR READ ONLY. { A = NIL; } /* ----- opt_for_locking_clause ----- */ opt_for_locking_clause(A) ::= for_locking_clause(B). { A = B; } opt_for_locking_clause(A) ::= . { A = NIL; } /* ----- for_locking_items ----- */ for_locking_items(A) ::= for_locking_item(B). { A = list_make1(B); } for_locking_items(A) ::= for_locking_items(B) for_locking_item(C). { A = lappend(B, C); } /* ----- for_locking_item ----- */ for_locking_item(A) ::= for_locking_strength(B) locked_rels_list(C) opt_nowait_or_skip(D). { LockingClause *n = makeNode(LockingClause); n->lockedRels = C; n->strength = B; n->waitPolicy = D; A = (Node *) n; } /* ----- for_locking_strength ----- */ for_locking_strength(A) ::= FOR UPDATE. { A = LCS_FORUPDATE; } for_locking_strength(A) ::= FOR NO KEY UPDATE. { A = LCS_FORNOKEYUPDATE; } for_locking_strength(A) ::= FOR SHARE. { A = LCS_FORSHARE; } for_locking_strength(A) ::= FOR KEY SHARE. { A = LCS_FORKEYSHARE; } /* ----- opt_for_locking_strength ----- */ opt_for_locking_strength(A) ::= for_locking_strength(B). { A = B; } opt_for_locking_strength(A) ::= . { A = LCS_NONE; } /* ----- locked_rels_list ----- */ locked_rels_list(A) ::= OF qualified_name_list(C). { A = C; } locked_rels_list(A) ::= . { A = NIL; } /* ----- values_clause ----- */ values_clause(A) ::= VALUES LPAREN expr_list(D) RPAREN. { selectStmt *n = makeNode(selectStmt); n->valuesLists = list_make1(D); A = (Node *) n; } values_clause(A) ::= values_clause(B) COMMA LPAREN expr_list(E) RPAREN. { selectStmt *n = (selectStmt *) B; n->valuesLists = lappend(n->valuesLists, E); A = (Node *) n; } /* ----- from_clause ----- */ from_clause(A) ::= FROM from_list(C). { A = C; } from_clause(A) ::= . { A = NIL; } /* ----- from_list ----- */ from_list(A) ::= table_ref(B). { A = list_make1(B); } from_list(A) ::= from_list(B) COMMA table_ref(D). { A = lappend(B, D); } /* ----- table_ref ----- */ table_ref(A) ::= relation_expr(B) opt_alias_clause(C). { B->alias = C; A = (Node *) B; } table_ref(A) ::= relation_expr(B) opt_alias_clause(C) tablesample_clause(D). { RangeTableSample *n = (RangeTableSample *) D; B->alias = C; n->relation = (Node *) B; A = (Node *) n; } table_ref(A) ::= func_table(B) func_alias_clause(C). { RangeFunction *n = (RangeFunction *) B; n->alias = linitial(C); n->coldeflist = lsecond(C); A = (Node *) n; } table_ref(A) ::= LATERAL_P func_table(C) func_alias_clause(D). { RangeFunction *n = (RangeFunction *) C; n->lateral = true; n->alias = linitial(D); n->coldeflist = lsecond(D); A = (Node *) n; } table_ref(A) ::= xmltable(B) opt_alias_clause(C). { RangeTableFunc *n = (RangeTableFunc *) B; n->alias = C; A = (Node *) n; } table_ref(A) ::= LATERAL_P xmltable(C) opt_alias_clause(D). { RangeTableFunc *n = (RangeTableFunc *) C; n->lateral = true; n->alias = D; A = (Node *) n; } table_ref(A) ::= GRAPH_TABLE LPAREN qualified_name(D) MATCH graph_pattern(F) COLUMNS LPAREN labeled_expr_list(I) RPAREN RPAREN opt_alias_clause(L). { RangeGraphTable *n = makeNode(RangeGraphTable); n->graph_name = D; n->graph_pattern = castNode(GraphPattern, F); n->columns = I; n->alias = L; n->location = LOC(B); A = (Node *) n; } table_ref(A) ::= select_with_parens(B) opt_alias_clause(C). { RangeSubselect *n = makeNode(RangeSubselect); n->lateral = false; n->subquery = B; n->alias = C; A = (Node *) n; } table_ref(A) ::= LATERAL_P select_with_parens(C) opt_alias_clause(D). { RangeSubselect *n = makeNode(RangeSubselect); n->lateral = true; n->subquery = C; n->alias = D; A = (Node *) n; } table_ref(A) ::= joined_table(B). { A = (Node *) B; } table_ref(A) ::= LPAREN joined_table(C) RPAREN alias_clause(E). { C->alias = E; A = (Node *) C; } table_ref(A) ::= json_table(B) opt_alias_clause(C). { JsonTable *jt = castNode(JsonTable, B); jt->alias = C; A = (Node *) jt; } table_ref(A) ::= LATERAL_P json_table(C) opt_alias_clause(D). { JsonTable *jt = castNode(JsonTable, C); jt->alias = D; jt->lateral = true; A = (Node *) jt; } /* ----- joined_table ----- */ joined_table(A) ::= LPAREN joined_table(C) RPAREN. { A = C; } joined_table(A) ::= table_ref(B) CROSS JOIN table_ref(E). { JoinExpr *n = makeNode(JoinExpr); n->jointype = JOIN_INNER; n->isNatural = false; n->larg = B; n->rarg = E; n->usingClause = NIL; n->join_using_alias = NULL; n->quals = NULL; A = n; } joined_table(A) ::= table_ref(B) join_type(C) JOIN table_ref(E) join_qual(F). { JoinExpr *n = makeNode(JoinExpr); n->jointype = C; n->isNatural = false; n->larg = B; n->rarg = E; if (F != NULL && IsA(F, List)) { n->usingClause = linitial_node(List, castNode(List, F)); n->join_using_alias = lsecond_node(Alias, castNode(List, F)); } else { n->quals = F; } A = n; } joined_table(A) ::= table_ref(B) JOIN table_ref(D) join_qual(E). { JoinExpr *n = makeNode(JoinExpr); n->jointype = JOIN_INNER; n->isNatural = false; n->larg = B; n->rarg = D; if (E != NULL && IsA(E, List)) { n->usingClause = linitial_node(List, castNode(List, E)); n->join_using_alias = lsecond_node(Alias, castNode(List, E)); } else { n->quals = E; } A = n; } joined_table(A) ::= table_ref(B) NATURAL join_type(D) JOIN table_ref(F). { JoinExpr *n = makeNode(JoinExpr); n->jointype = D; n->isNatural = true; n->larg = B; n->rarg = F; n->usingClause = NIL; n->join_using_alias = NULL; n->quals = NULL; A = n; } joined_table(A) ::= table_ref(B) NATURAL JOIN table_ref(E). { JoinExpr *n = makeNode(JoinExpr); n->jointype = JOIN_INNER; n->isNatural = true; n->larg = B; n->rarg = E; n->usingClause = NIL; n->join_using_alias = NULL; n->quals = NULL; A = n; } /* ----- alias_clause ----- */ alias_clause(A) ::= AS colId(C) LPAREN name_list(E) RPAREN. { A = makeNode(Alias); A->aliasname = C; A->colnames = E; } alias_clause(A) ::= AS colId(C). { A = makeNode(Alias); A->aliasname = C; } alias_clause(A) ::= colId(B) LPAREN name_list(D) RPAREN. { A = makeNode(Alias); A->aliasname = B; A->colnames = D; } alias_clause(A) ::= colId(B). { A = makeNode(Alias); A->aliasname = B; } /* ----- opt_alias_clause ----- */ opt_alias_clause(A) ::= alias_clause(B). { A = B; } opt_alias_clause(A) ::= . { A = NULL; } /* ----- opt_alias_clause_for_join_using ----- */ opt_alias_clause_for_join_using(A) ::= AS colId(C). { A = makeNode(Alias); A->aliasname = C; } opt_alias_clause_for_join_using(A) ::= . { A = NULL; } /* ----- func_alias_clause ----- */ func_alias_clause(A) ::= alias_clause(B). { A = list_make2(B, NIL); } func_alias_clause(A) ::= AS LPAREN tableFuncElementList(D) RPAREN. { A = list_make2(NULL, D); } func_alias_clause(A) ::= AS colId(C) LPAREN tableFuncElementList(E) RPAREN. { Alias *a = makeNode(Alias); a->aliasname = C; A = list_make2(a, E); } func_alias_clause(A) ::= colId(B) LPAREN tableFuncElementList(D) RPAREN. { Alias *a = makeNode(Alias); a->aliasname = B; A = list_make2(a, D); } func_alias_clause(A) ::= . { A = list_make2(NULL, NIL); } /* ----- join_type ----- */ join_type(A) ::= FULL opt_outer(C). { A = JOIN_FULL; } join_type(A) ::= LEFT opt_outer(C). { A = JOIN_LEFT; } join_type(A) ::= RIGHT opt_outer(C). { A = JOIN_RIGHT; } join_type(A) ::= INNER_P. { A = JOIN_INNER; } /* ----- opt_outer ----- */ opt_outer(A) ::= OUTER_P. /* ----- join_qual ----- */ join_qual(A) ::= USING LPAREN name_list(D) RPAREN opt_alias_clause_for_join_using(F). { A = (Node *) list_make2(D, F); } join_qual(A) ::= ON a_expr(C). { A = C; } /* ----- relation_expr ----- */ relation_expr(A) ::= qualified_name(B). { A = B; A->inh = true; A->alias = NULL; } relation_expr(A) ::= extended_relation_expr(B). { A = B; } /* ----- extended_relation_expr ----- */ extended_relation_expr(A) ::= qualified_name(B) STAR. { A = B; A->inh = true; A->alias = NULL; } extended_relation_expr(A) ::= ONLY qualified_name(C). { A = C; A->inh = false; A->alias = NULL; } extended_relation_expr(A) ::= ONLY LPAREN qualified_name(D) RPAREN. { A = D; A->inh = false; A->alias = NULL; } /* ----- relation_expr_list ----- */ relation_expr_list(A) ::= relation_expr(B). { A = list_make1(B); } relation_expr_list(A) ::= relation_expr_list(B) COMMA relation_expr(D). { A = lappend(B, D); } /* ----- relation_expr_opt_alias ----- */ relation_expr_opt_alias(A) ::= relation_expr(B). [UMINUS] { A = B; } relation_expr_opt_alias(A) ::= relation_expr(B) colId(C). { Alias *alias = makeNode(Alias); alias->aliasname = C; B->alias = alias; A = B; } relation_expr_opt_alias(A) ::= relation_expr(B) AS colId(D). { Alias *alias = makeNode(Alias); alias->aliasname = D; B->alias = alias; A = B; } /* ----- tablesample_clause ----- */ tablesample_clause(A) ::= TABLESAMPLE func_name(C) LPAREN expr_list(E) RPAREN opt_repeatable_clause(G). { RangeTableSample *n = makeNode(RangeTableSample); n->method = C; n->args = E; n->repeatable = G; n->location = LOC(C); A = (Node *) n; } /* ----- opt_repeatable_clause ----- */ opt_repeatable_clause(A) ::= REPEATABLE LPAREN a_expr(D) RPAREN. { A = (Node *) D; } opt_repeatable_clause(A) ::= . { A = NULL; } /* ----- func_table ----- */ func_table(A) ::= func_expr_windowless(B) opt_ordinality(C). { RangeFunction *n = makeNode(RangeFunction); n->lateral = false; n->ordinality = C; n->is_rowsfrom = false; n->functions = list_make1(list_make2(B, NIL)); A = (Node *) n; } func_table(A) ::= ROWS FROM LPAREN rowsfrom_list(E) RPAREN opt_ordinality(G). { RangeFunction *n = makeNode(RangeFunction); n->lateral = false; n->ordinality = G; n->is_rowsfrom = true; n->functions = E; A = (Node *) n; } /* ----- rowsfrom_item ----- */ rowsfrom_item(A) ::= func_expr_windowless(B) opt_col_def_list(C). { A = list_make2(B, C); } /* ----- rowsfrom_list ----- */ rowsfrom_list(A) ::= rowsfrom_item(B). { A = list_make1(B); } rowsfrom_list(A) ::= rowsfrom_list(B) COMMA rowsfrom_item(D). { A = lappend(B, D); } /* ----- opt_col_def_list ----- */ opt_col_def_list(A) ::= AS LPAREN tableFuncElementList(D) RPAREN. { A = D; } opt_col_def_list(A) ::= . { A = NIL; } /* ----- opt_ordinality ----- */ opt_ordinality(A) ::= WITH_LA ORDINALITY. { A = true; } opt_ordinality(A) ::= . { A = false; } /* ----- where_clause ----- */ where_clause(A) ::= WHERE a_expr(C). { A = C; } where_clause(A) ::= . { A = NULL; } /* ----- where_or_current_clause ----- */ where_or_current_clause(A) ::= WHERE a_expr(C). { A = C; } where_or_current_clause(A) ::= WHERE CURRENT_P OF cursor_name(E). { CurrentOfExpr *n = makeNode(CurrentOfExpr); n->cursor_name = E; n->cursor_param = 0; A = (Node *) n; } where_or_current_clause(A) ::= . { A = NULL; } /* ----- optTableFuncElementList ----- */ optTableFuncElementList(A) ::= tableFuncElementList(B). { A = B; } optTableFuncElementList(A) ::= . { A = NIL; } /* ----- tableFuncElementList ----- */ tableFuncElementList(A) ::= tableFuncElement(B). { A = list_make1(B); } tableFuncElementList(A) ::= tableFuncElementList(B) COMMA tableFuncElement(D). { A = lappend(B, D); } /* ----- tableFuncElement ----- */ tableFuncElement(A) ::= colId(B) typename(C) opt_collate_clause(D). { ColumnDef *n = makeNode(ColumnDef); n->colname = B; n->typeName = C; n->inhcount = 0; n->is_local = true; n->is_not_null = false; n->is_from_type = false; n->storage = 0; n->raw_default = NULL; n->cooked_default = NULL; n->collClause = (CollateClause *) D; n->collOid = InvalidOid; n->constraints = NIL; n->location = LOC(B); A = (Node *) n; } /* ----- xmltable ----- */ xmltable(A) ::= XMLTABLE LPAREN c_expr(D) xmlexists_argument(E) COLUMNS xmltable_column_list(G) RPAREN. { RangeTableFunc *n = makeNode(RangeTableFunc); n->rowexpr = D; n->docexpr = E; n->columns = G; n->namespaces = NIL; n->location = LOC(B); A = (Node *) n; } xmltable(A) ::= XMLTABLE LPAREN XMLNAMESPACES LPAREN xml_namespace_list(F) RPAREN COMMA c_expr(I) xmlexists_argument(J) COLUMNS xmltable_column_list(L) RPAREN. { RangeTableFunc *n = makeNode(RangeTableFunc); n->rowexpr = I; n->docexpr = J; n->columns = L; n->namespaces = F; n->location = LOC(B); A = (Node *) n; } /* ----- xmltable_column_list ----- */ xmltable_column_list(A) ::= xmltable_column_el(B). { A = list_make1(B); } xmltable_column_list(A) ::= xmltable_column_list(B) COMMA xmltable_column_el(D). { A = lappend(B, D); } /* ----- xmltable_column_el ----- */ xmltable_column_el(A) ::= colId(B) typename(C). { RangeTableFuncCol *fc = makeNode(RangeTableFuncCol); fc->colname = B; fc->for_ordinality = false; fc->typeName = C; fc->is_not_null = false; fc->colexpr = NULL; fc->coldefexpr = NULL; fc->location = LOC(B); A = (Node *) fc; } xmltable_column_el(A) ::= colId(B) typename(C) xmltable_column_option_list(D). { RangeTableFuncCol *fc = makeNode(RangeTableFuncCol); ListCell *option; bool nullability_seen = false; fc->colname = B; fc->typeName = C; fc->for_ordinality = false; fc->is_not_null = false; fc->colexpr = NULL; fc->coldefexpr = NULL; fc->location = LOC(B); foreach(option, D) { DefElem *defel = (DefElem *) lfirst(option); if (strcmp(defel->defname, "default") == 0) { if (fc->coldefexpr != NULL) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("only one DEFAULT value is allowed"), parser_errposition(defel->location))); fc->coldefexpr = defel->arg; } else if (strcmp(defel->defname, "path") == 0) { if (fc->colexpr != NULL) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("only one PATH value per column is allowed"), parser_errposition(defel->location))); fc->colexpr = defel->arg; } else if (strcmp(defel->defname, "__pg__is_not_null") == 0) { if (nullability_seen) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("conflicting or redundant NULL / NOT NULL declarations for column \"%s\"", fc->colname), parser_errposition(defel->location))); fc->is_not_null = boolVal(defel->arg); nullability_seen = true; } else { ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("unrecognized column option \"%s\"", defel->defname), parser_errposition(defel->location))); } } A = (Node *) fc; } xmltable_column_el(A) ::= colId(B) FOR ORDINALITY. { RangeTableFuncCol *fc = makeNode(RangeTableFuncCol); fc->colname = B; fc->for_ordinality = true; fc->location = LOC(B); A = (Node *) fc; } /* ----- xmltable_column_option_list ----- */ xmltable_column_option_list(A) ::= xmltable_column_option_el(B). { A = list_make1(B); } xmltable_column_option_list(A) ::= xmltable_column_option_list(B) xmltable_column_option_el(C). { A = lappend(B, C); } /* ----- xmltable_column_option_el ----- */ xmltable_column_option_el(A) ::= IDENT b_expr(C). { if (strcmp(B, "__pg__is_not_null") == 0) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("option name \"%s\" cannot be used in XMLTABLE", B), parser_errposition(LOC(B)))); A = makeDefElem(B, C, LOC(B)); } xmltable_column_option_el(A) ::= DEFAULT b_expr(C). { A = makeDefElem("default", C, LOC(B)); } xmltable_column_option_el(A) ::= NOT NULL_P. { A = makeDefElem("__pg__is_not_null", (Node *) makeBoolean(true), LOC(B)); } xmltable_column_option_el(A) ::= NULL_P. { A = makeDefElem("__pg__is_not_null", (Node *) makeBoolean(false), LOC(B)); } xmltable_column_option_el(A) ::= PATH b_expr(C). { A = makeDefElem("path", C, LOC(B)); } /* ----- xml_namespace_list ----- */ xml_namespace_list(A) ::= xml_namespace_el(B). { A = list_make1(B); } xml_namespace_list(A) ::= xml_namespace_list(B) COMMA xml_namespace_el(D). { A = lappend(B, D); } /* ----- xml_namespace_el ----- */ xml_namespace_el(A) ::= b_expr(B) AS colLabel(D). { A = makeNode(ResTarget); A->name = D; A->indirection = NIL; A->val = B; A->location = LOC(B); } xml_namespace_el(A) ::= DEFAULT b_expr(C). { A = makeNode(ResTarget); A->name = NULL; A->indirection = NIL; A->val = C; A->location = LOC(B); } /* ----- json_table ----- */ json_table(A) ::= JSON_TABLE LPAREN json_value_expr(D) COMMA a_expr(F) json_table_path_name_opt(G) json_passing_clause_opt(H) COLUMNS LPAREN json_table_column_definition_list(K) RPAREN json_on_error_clause_opt(M) RPAREN. { JsonTable *n = makeNode(JsonTable); char *pathstring; n->context_item = (JsonValueExpr *) D; if (!IsA(F, A_Const) || castNode(A_Const, F)->val.node.type != T_String) ereport(ERROR, errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("only string constants are supported in JSON_TABLE path specification"), parser_errposition(LOC(F))); pathstring = castNode(A_Const, F)->val.sval.sval; n->pathspec = makeJsonTablePathSpec(pathstring, G, LOC(F), LOC(G)); n->passing = H; n->columns = K; n->on_error = (JsonBehavior *) M; n->location = LOC(B); A = (Node *) n; } /* ----- json_table_path_name_opt ----- */ json_table_path_name_opt(A) ::= AS name(C). { A = C; } json_table_path_name_opt(A) ::= . { A = NULL; } /* ----- json_table_column_definition_list ----- */ json_table_column_definition_list(A) ::= json_table_column_definition(B). { A = list_make1(B); } json_table_column_definition_list(A) ::= json_table_column_definition_list(B) COMMA json_table_column_definition(D). { A = lappend(B, D); } /* ----- json_table_column_definition ----- */ json_table_column_definition(A) ::= colId(B) FOR ORDINALITY. { JsonTableColumn *n = makeNode(JsonTableColumn); n->coltype = JTC_FOR_ORDINALITY; n->name = B; n->location = LOC(B); A = (Node *) n; } json_table_column_definition(A) ::= colId(B) typename(C) json_table_column_path_clause_opt(D) json_wrapper_behavior(E) json_quotes_clause_opt(F) json_behavior_clause_opt(G). { JsonTableColumn *n = makeNode(JsonTableColumn); n->coltype = JTC_REGULAR; n->name = B; n->typeName = C; n->format = makeJsonFormat(JS_FORMAT_DEFAULT, JS_ENC_DEFAULT, -1); n->pathspec = (JsonTablePathSpec *) D; n->wrapper = E; n->quotes = F; n->on_empty = (JsonBehavior *) linitial(G); n->on_error = (JsonBehavior *) lsecond(G); n->location = LOC(B); A = (Node *) n; } json_table_column_definition(A) ::= colId(B) typename(C) json_format_clause(D) json_table_column_path_clause_opt(E) json_wrapper_behavior(F) json_quotes_clause_opt(G) json_behavior_clause_opt(H). { JsonTableColumn *n = makeNode(JsonTableColumn); n->coltype = JTC_FORMATTED; n->name = B; n->typeName = C; n->format = (JsonFormat *) D; n->pathspec = (JsonTablePathSpec *) E; n->wrapper = F; n->quotes = G; n->on_empty = (JsonBehavior *) linitial(H); n->on_error = (JsonBehavior *) lsecond(H); n->location = LOC(B); A = (Node *) n; } json_table_column_definition(A) ::= colId(B) typename(C) EXISTS json_table_column_path_clause_opt(E) json_on_error_clause_opt(F). { JsonTableColumn *n = makeNode(JsonTableColumn); n->coltype = JTC_EXISTS; n->name = B; n->typeName = C; n->format = makeJsonFormat(JS_FORMAT_DEFAULT, JS_ENC_DEFAULT, -1); n->wrapper = JSW_NONE; n->quotes = JS_QUOTES_UNSPEC; n->pathspec = (JsonTablePathSpec *) E; n->on_empty = NULL; n->on_error = (JsonBehavior *) F; n->location = LOC(B); A = (Node *) n; } json_table_column_definition(A) ::= NESTED path_opt(C) sconst(D) COLUMNS LPAREN json_table_column_definition_list(G) RPAREN. { JsonTableColumn *n = makeNode(JsonTableColumn); n->coltype = JTC_NESTED; n->pathspec = (JsonTablePathSpec *) makeJsonTablePathSpec(D, NULL, LOC(D), -1); n->columns = G; n->location = LOC(B); A = (Node *) n; } json_table_column_definition(A) ::= NESTED path_opt(C) sconst(D) AS name(F) COLUMNS LPAREN json_table_column_definition_list(I) RPAREN. { JsonTableColumn *n = makeNode(JsonTableColumn); n->coltype = JTC_NESTED; n->pathspec = (JsonTablePathSpec *) makeJsonTablePathSpec(D, F, LOC(D), LOC(F)); n->columns = I; n->location = LOC(B); A = (Node *) n; } /* ----- path_opt ----- */ path_opt(A) ::= PATH. /* ----- json_table_column_path_clause_opt ----- */ json_table_column_path_clause_opt(A) ::= PATH sconst(C). { A = (Node *) makeJsonTablePathSpec(C, NULL, LOC(C), -1); } json_table_column_path_clause_opt(A) ::= . { A = NULL; } /* ----- typename ----- */ typename(A) ::= simpleTypename(B) opt_array_bounds(C). { A = B; A->arrayBounds = C; } typename(A) ::= SETOF simpleTypename(C) opt_array_bounds(D). { A = C; A->arrayBounds = D; A->setof = true; } typename(A) ::= simpleTypename(B) ARRAY LBRACKET iconst(E) RBRACKET. { A = B; A->arrayBounds = list_make1(makeInteger(E)); } typename(A) ::= SETOF simpleTypename(C) ARRAY LBRACKET iconst(F) RBRACKET. { A = C; A->arrayBounds = list_make1(makeInteger(F)); A->setof = true; } typename(A) ::= simpleTypename(B) ARRAY. { A = B; A->arrayBounds = list_make1(makeInteger(-1)); } typename(A) ::= SETOF simpleTypename(C) ARRAY. { A = C; A->arrayBounds = list_make1(makeInteger(-1)); A->setof = true; } /* ----- opt_array_bounds ----- */ opt_array_bounds(A) ::= opt_array_bounds(B) LBRACKET RBRACKET. { A = lappend(B, makeInteger(-1)); } opt_array_bounds(A) ::= opt_array_bounds(B) LBRACKET iconst(D) RBRACKET. { A = lappend(B, makeInteger(D)); } opt_array_bounds(A) ::= . { A = NIL; } /* ----- simpleTypename ----- */ simpleTypename(A) ::= genericType(B). { A = B; } simpleTypename(A) ::= numeric(B). { A = B; } simpleTypename(A) ::= bit(B). { A = B; } simpleTypename(A) ::= character_tn(B). { A = B; } simpleTypename(A) ::= constDatetime(B). { A = B; } simpleTypename(A) ::= constInterval(B) opt_interval(C). { A = B; A->typmods = C; } simpleTypename(A) ::= constInterval(B) LPAREN iconst(D) RPAREN. { A = B; A->typmods = list_make2(makeIntConst(INTERVAL_FULL_RANGE, -1), makeIntConst(D, LOC(D))); } simpleTypename(A) ::= jsonType(B). { A = B; } /* ----- constTypename ----- */ constTypename(A) ::= numeric(B). { A = B; } constTypename(A) ::= constBit(B). { A = B; } constTypename(A) ::= constCharacter(B). { A = B; } constTypename(A) ::= constDatetime(B). { A = B; } constTypename(A) ::= jsonType(B). { A = B; } /* ----- genericType ----- */ genericType(A) ::= type_function_name(B) opt_type_modifiers(C). { A = makeTypeName(B); A->typmods = C; A->location = LOC(B); } genericType(A) ::= type_function_name(B) attrs(C) opt_type_modifiers(D). { A = makeTypeNameFromNameList(lcons(makeString(B), C)); A->typmods = D; A->location = LOC(B); } /* ----- opt_type_modifiers ----- */ opt_type_modifiers(A) ::= LPAREN expr_list(C) RPAREN. { A = C; } opt_type_modifiers(A) ::= . { A = NIL; } /* ----- numeric ----- */ numeric(A) ::= INT_P. { A = SystemTypeName("int4"); A->location = LOC(B); } numeric(A) ::= INTEGER. { A = SystemTypeName("int4"); A->location = LOC(B); } numeric(A) ::= SMALLINT. { A = SystemTypeName("int2"); A->location = LOC(B); } numeric(A) ::= BIGINT. { A = SystemTypeName("int8"); A->location = LOC(B); } numeric(A) ::= REAL. { A = SystemTypeName("float4"); A->location = LOC(B); } numeric(A) ::= FLOAT_P opt_float(C). { A = C; A->location = LOC(B); } numeric(A) ::= DOUBLE_P PRECISION. { A = SystemTypeName("float8"); A->location = LOC(B); } numeric(A) ::= DECIMAL_P opt_type_modifiers(C). { A = SystemTypeName("numeric"); A->typmods = C; A->location = LOC(B); } numeric(A) ::= DEC opt_type_modifiers(C). { A = SystemTypeName("numeric"); A->typmods = C; A->location = LOC(B); } numeric(A) ::= NUMERIC opt_type_modifiers(C). { A = SystemTypeName("numeric"); A->typmods = C; A->location = LOC(B); } numeric(A) ::= BOOLEAN_P. { A = SystemTypeName("bool"); A->location = LOC(B); } /* ----- opt_float ----- */ opt_float(A) ::= LPAREN iconst(C) RPAREN. { if (C < 1) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("precision for type float must be at least 1 bit"), parser_errposition(LOC(C)))); else if (C <= 24) A = SystemTypeName("float4"); else if (C <= 53) A = SystemTypeName("float8"); else ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("precision for type float must be less than 54 bits"), parser_errposition(LOC(C)))); } opt_float(A) ::= . { A = SystemTypeName("float8"); } /* ----- bit ----- */ bit(A) ::= bitWithLength(B). { A = B; } bit(A) ::= bitWithoutLength(B). { A = B; } /* ----- constBit ----- */ constBit(A) ::= bitWithLength(B). { A = B; } constBit(A) ::= bitWithoutLength(B). { A = B; A->typmods = NIL; } /* ----- bitWithLength ----- */ bitWithLength(A) ::= BIT opt_varying(C) LPAREN expr_list(E) RPAREN. { char *typname; typname = C ? "varbit" : "bit"; A = SystemTypeName(typname); A->typmods = E; A->location = LOC(B); } /* ----- bitWithoutLength ----- */ bitWithoutLength(A) ::= BIT opt_varying(C). { if (C) { A = SystemTypeName("varbit"); } else { A = SystemTypeName("bit"); A->typmods = list_make1(makeIntConst(1, -1)); } A->location = LOC(B); } /* ----- character ----- */ character_tn(A) ::= characterWithLength(B). { A = B; } character_tn(A) ::= characterWithoutLength(B). { A = B; } /* ----- constCharacter ----- */ constCharacter(A) ::= characterWithLength(B). { A = B; } constCharacter(A) ::= characterWithoutLength(B). { A = B; A->typmods = NIL; } /* ----- characterWithLength ----- */ characterWithLength(A) ::= character(B) LPAREN iconst(D) RPAREN. { A = SystemTypeName(B); A->typmods = list_make1(makeIntConst(D, LOC(D))); A->location = LOC(B); } /* ----- characterWithoutLength ----- */ characterWithoutLength(A) ::= character(B). { A = SystemTypeName(B); if (strcmp(B, "bpchar") == 0) A->typmods = list_make1(makeIntConst(1, -1)); A->location = LOC(B); } /* ----- character ----- */ character(A) ::= CHARACTER opt_varying(C). { A = C ? "varchar": "bpchar"; } character(A) ::= CHAR_P opt_varying(C). { A = C ? "varchar": "bpchar"; } character(A) ::= VARCHAR. { A = "varchar"; } character(A) ::= NATIONAL CHARACTER opt_varying(D). { A = D ? "varchar": "bpchar"; } character(A) ::= NATIONAL CHAR_P opt_varying(D). { A = D ? "varchar": "bpchar"; } character(A) ::= NCHAR opt_varying(C). { A = C ? "varchar": "bpchar"; } /* ----- opt_varying ----- */ opt_varying(A) ::= VARYING. { A = true; } opt_varying(A) ::= . { A = false; } /* ----- constDatetime ----- */ constDatetime(A) ::= TIMESTAMP LPAREN iconst(D) RPAREN opt_timezone(F). { if (F) A = SystemTypeName("timestamptz"); else A = SystemTypeName("timestamp"); A->typmods = list_make1(makeIntConst(D, LOC(D))); A->location = LOC(B); } constDatetime(A) ::= TIMESTAMP opt_timezone(C). { if (C) A = SystemTypeName("timestamptz"); else A = SystemTypeName("timestamp"); A->location = LOC(B); } constDatetime(A) ::= TIME LPAREN iconst(D) RPAREN opt_timezone(F). { if (F) A = SystemTypeName("timetz"); else A = SystemTypeName("time"); A->typmods = list_make1(makeIntConst(D, LOC(D))); A->location = LOC(B); } constDatetime(A) ::= TIME opt_timezone(C). { if (C) A = SystemTypeName("timetz"); else A = SystemTypeName("time"); A->location = LOC(B); } /* ----- constInterval ----- */ constInterval(A) ::= INTERVAL. { A = SystemTypeName("interval"); A->location = LOC(B); } /* ----- opt_timezone ----- */ opt_timezone(A) ::= WITH_LA TIME ZONE. { A = true; } opt_timezone(A) ::= WITHOUT_LA TIME ZONE. { A = false; } opt_timezone(A) ::= . { A = false; } /* ----- opt_interval ----- */ opt_interval(A) ::= YEAR_P. { A = list_make1(makeIntConst(INTERVAL_MASK(YEAR), LOC(B))); } opt_interval(A) ::= MONTH_P. { A = list_make1(makeIntConst(INTERVAL_MASK(MONTH), LOC(B))); } opt_interval(A) ::= DAY_P. { A = list_make1(makeIntConst(INTERVAL_MASK(DAY), LOC(B))); } opt_interval(A) ::= HOUR_P. { A = list_make1(makeIntConst(INTERVAL_MASK(HOUR), LOC(B))); } opt_interval(A) ::= MINUTE_P. { A = list_make1(makeIntConst(INTERVAL_MASK(MINUTE), LOC(B))); } opt_interval(A) ::= interval_second(B). { A = B; } opt_interval(A) ::= YEAR_P TO MONTH_P. { A = list_make1(makeIntConst(INTERVAL_MASK(YEAR) | INTERVAL_MASK(MONTH), LOC(B))); } opt_interval(A) ::= DAY_P TO HOUR_P. { A = list_make1(makeIntConst(INTERVAL_MASK(DAY) | INTERVAL_MASK(HOUR), LOC(B))); } opt_interval(A) ::= DAY_P TO MINUTE_P. { A = list_make1(makeIntConst(INTERVAL_MASK(DAY) | INTERVAL_MASK(HOUR) | INTERVAL_MASK(MINUTE), LOC(B))); } opt_interval(A) ::= DAY_P TO interval_second(D). { A = D; linitial(A) = makeIntConst(INTERVAL_MASK(DAY) | INTERVAL_MASK(HOUR) | INTERVAL_MASK(MINUTE) | INTERVAL_MASK(SECOND), LOC(B)); } opt_interval(A) ::= HOUR_P TO MINUTE_P. { A = list_make1(makeIntConst(INTERVAL_MASK(HOUR) | INTERVAL_MASK(MINUTE), LOC(B))); } opt_interval(A) ::= HOUR_P TO interval_second(D). { A = D; linitial(A) = makeIntConst(INTERVAL_MASK(HOUR) | INTERVAL_MASK(MINUTE) | INTERVAL_MASK(SECOND), LOC(B)); } opt_interval(A) ::= MINUTE_P TO interval_second(D). { A = D; linitial(A) = makeIntConst(INTERVAL_MASK(MINUTE) | INTERVAL_MASK(SECOND), LOC(B)); } opt_interval(A) ::= . { A = NIL; } /* ----- interval_second ----- */ interval_second(A) ::= SECOND_P. { A = list_make1(makeIntConst(INTERVAL_MASK(SECOND), LOC(B))); } interval_second(A) ::= SECOND_P LPAREN iconst(D) RPAREN. { A = list_make2(makeIntConst(INTERVAL_MASK(SECOND), LOC(B)), makeIntConst(D, LOC(D))); } /* ----- jsonType ----- */ jsonType(A) ::= JSON. { A = SystemTypeName("json"); A->location = LOC(B); } /* ----- a_expr ----- */ a_expr(A) ::= c_expr(B). { A = B; } a_expr(A) ::= a_expr(B) TYPECAST typename(D). { A = makeTypeCast(B, D, LOC(C)); } a_expr(A) ::= a_expr(B) COLLATE any_name(D). { CollateClause *n = makeNode(CollateClause); n->arg = B; n->collname = D; n->location = LOC(C); A = (Node *) n; } a_expr(A) ::= a_expr(B) AT TIME ZONE a_expr(F). [AT] { A = (Node *) makeFuncCall(SystemFuncName("timezone"), list_make2(F, B), COERCE_SQL_SYNTAX, LOC(C)); } a_expr(A) ::= a_expr(B) AT LOCAL. [AT] { A = (Node *) makeFuncCall(SystemFuncName("timezone"), list_make1(B), COERCE_SQL_SYNTAX, -1); } a_expr(A) ::= PLUS a_expr(C). [UMINUS] { A = (Node *) makeSimpleA_Expr(AEXPR_OP, "+", NULL, C, LOC(B)); } a_expr(A) ::= MINUS a_expr(C). [UMINUS] { A = doNegate(C, LOC(B)); } a_expr(A) ::= a_expr(B) PLUS a_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_OP, "+", B, D, LOC(C)); } a_expr(A) ::= a_expr(B) MINUS a_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_OP, "-", B, D, LOC(C)); } a_expr(A) ::= a_expr(B) STAR a_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_OP, "*", B, D, LOC(C)); } a_expr(A) ::= a_expr(B) SLASH a_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_OP, "/", B, D, LOC(C)); } a_expr(A) ::= a_expr(B) PERCENT a_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_OP, "%", B, D, LOC(C)); } a_expr(A) ::= a_expr(B) CARET a_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_OP, "^", B, D, LOC(C)); } a_expr(A) ::= a_expr(B) LT a_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_OP, "<", B, D, LOC(C)); } a_expr(A) ::= a_expr(B) GT a_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_OP, ">", B, D, LOC(C)); } a_expr(A) ::= a_expr(B) EQ a_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_OP, "=", B, D, LOC(C)); } a_expr(A) ::= a_expr(B) LESS_EQUALS a_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_OP, "<=", B, D, LOC(C)); } a_expr(A) ::= a_expr(B) GREATER_EQUALS a_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_OP, ">=", B, D, LOC(C)); } a_expr(A) ::= a_expr(B) NOT_EQUALS a_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_OP, "<>", B, D, LOC(C)); } a_expr(A) ::= a_expr(B) RIGHT_ARROW a_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_OP, "->", B, D, LOC(C)); } a_expr(A) ::= a_expr(B) PIPE a_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_OP, "|", B, D, LOC(C)); } a_expr(A) ::= a_expr(B) qual_Op(C) a_expr(D). [OP] { A = (Node *) makeA_Expr(AEXPR_OP, C, B, D, LOC(C)); } a_expr(A) ::= qual_Op(B) a_expr(C). [OP] { A = (Node *) makeA_Expr(AEXPR_OP, B, NULL, C, LOC(B)); } a_expr(A) ::= a_expr(B) AND a_expr(D). { A = makeAndExpr(B, D, LOC(C)); } a_expr(A) ::= a_expr(B) OR a_expr(D). { A = makeOrExpr(B, D, LOC(C)); } a_expr(A) ::= NOT a_expr(C). { A = makeNotExpr(C, LOC(B)); } a_expr(A) ::= NOT_LA a_expr(C). [NOT] { A = makeNotExpr(C, LOC(B)); } a_expr(A) ::= a_expr(B) LIKE a_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_LIKE, "~~", B, D, LOC(C)); } a_expr(A) ::= a_expr(B) LIKE a_expr(D) ESCAPE a_expr(F). [LIKE] { FuncCall *n = makeFuncCall(SystemFuncName("like_escape"), list_make2(D, F), COERCE_EXPLICIT_CALL, LOC(C)); A = (Node *) makeSimpleA_Expr(AEXPR_LIKE, "~~", B, (Node *) n, LOC(C)); } a_expr(A) ::= a_expr(B) NOT_LA LIKE a_expr(E). [NOT_LA] { A = (Node *) makeSimpleA_Expr(AEXPR_LIKE, "!~~", B, E, LOC(C)); } a_expr(A) ::= a_expr(B) NOT_LA LIKE a_expr(E) ESCAPE a_expr(G). [NOT_LA] { FuncCall *n = makeFuncCall(SystemFuncName("like_escape"), list_make2(E, G), COERCE_EXPLICIT_CALL, LOC(C)); A = (Node *) makeSimpleA_Expr(AEXPR_LIKE, "!~~", B, (Node *) n, LOC(C)); } a_expr(A) ::= a_expr(B) ILIKE a_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_ILIKE, "~~*", B, D, LOC(C)); } a_expr(A) ::= a_expr(B) ILIKE a_expr(D) ESCAPE a_expr(F). [ILIKE] { FuncCall *n = makeFuncCall(SystemFuncName("like_escape"), list_make2(D, F), COERCE_EXPLICIT_CALL, LOC(C)); A = (Node *) makeSimpleA_Expr(AEXPR_ILIKE, "~~*", B, (Node *) n, LOC(C)); } a_expr(A) ::= a_expr(B) NOT_LA ILIKE a_expr(E). [NOT_LA] { A = (Node *) makeSimpleA_Expr(AEXPR_ILIKE, "!~~*", B, E, LOC(C)); } a_expr(A) ::= a_expr(B) NOT_LA ILIKE a_expr(E) ESCAPE a_expr(G). [NOT_LA] { FuncCall *n = makeFuncCall(SystemFuncName("like_escape"), list_make2(E, G), COERCE_EXPLICIT_CALL, LOC(C)); A = (Node *) makeSimpleA_Expr(AEXPR_ILIKE, "!~~*", B, (Node *) n, LOC(C)); } a_expr(A) ::= a_expr(B) SIMILAR TO a_expr(E). [SIMILAR] { FuncCall *n = makeFuncCall(SystemFuncName("similar_to_escape"), list_make1(E), COERCE_EXPLICIT_CALL, LOC(C)); A = (Node *) makeSimpleA_Expr(AEXPR_SIMILAR, "~", B, (Node *) n, LOC(C)); } a_expr(A) ::= a_expr(B) SIMILAR TO a_expr(E) ESCAPE a_expr(G). [SIMILAR] { FuncCall *n = makeFuncCall(SystemFuncName("similar_to_escape"), list_make2(E, G), COERCE_EXPLICIT_CALL, LOC(C)); A = (Node *) makeSimpleA_Expr(AEXPR_SIMILAR, "~", B, (Node *) n, LOC(C)); } a_expr(A) ::= a_expr(B) NOT_LA SIMILAR TO a_expr(F). [NOT_LA] { FuncCall *n = makeFuncCall(SystemFuncName("similar_to_escape"), list_make1(F), COERCE_EXPLICIT_CALL, LOC(C)); A = (Node *) makeSimpleA_Expr(AEXPR_SIMILAR, "!~", B, (Node *) n, LOC(C)); } a_expr(A) ::= a_expr(B) NOT_LA SIMILAR TO a_expr(F) ESCAPE a_expr(H). [NOT_LA] { FuncCall *n = makeFuncCall(SystemFuncName("similar_to_escape"), list_make2(F, H), COERCE_EXPLICIT_CALL, LOC(C)); A = (Node *) makeSimpleA_Expr(AEXPR_SIMILAR, "!~", B, (Node *) n, LOC(C)); } a_expr(A) ::= a_expr(B) IS NULL_P. [IS] { NullTest *n = makeNode(NullTest); n->arg = (Expr *) B; n->nulltesttype = IS_NULL; n->location = LOC(C); A = (Node *) n; } a_expr(A) ::= a_expr(B) ISNULL. { NullTest *n = makeNode(NullTest); n->arg = (Expr *) B; n->nulltesttype = IS_NULL; n->location = LOC(C); A = (Node *) n; } a_expr(A) ::= a_expr(B) IS NOT NULL_P. [IS] { NullTest *n = makeNode(NullTest); n->arg = (Expr *) B; n->nulltesttype = IS_NOT_NULL; n->location = LOC(C); A = (Node *) n; } a_expr(A) ::= a_expr(B) NOTNULL. { NullTest *n = makeNode(NullTest); n->arg = (Expr *) B; n->nulltesttype = IS_NOT_NULL; n->location = LOC(C); A = (Node *) n; } a_expr(A) ::= row(B) OVERLAPS row(D). { if (list_length(B) != 2) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("wrong number of parameters on left side of OVERLAPS expression"), parser_errposition(LOC(B)))); if (list_length(D) != 2) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("wrong number of parameters on right side of OVERLAPS expression"), parser_errposition(LOC(D)))); A = (Node *) makeFuncCall(SystemFuncName("overlaps"), list_concat(B, D), COERCE_SQL_SYNTAX, LOC(C)); } a_expr(A) ::= a_expr(B) IS TRUE_P. [IS] { BooleanTest *b = makeNode(BooleanTest); b->arg = (Expr *) B; b->booltesttype = IS_TRUE; b->location = LOC(C); A = (Node *) b; } a_expr(A) ::= a_expr(B) IS NOT TRUE_P. [IS] { BooleanTest *b = makeNode(BooleanTest); b->arg = (Expr *) B; b->booltesttype = IS_NOT_TRUE; b->location = LOC(C); A = (Node *) b; } a_expr(A) ::= a_expr(B) IS FALSE_P. [IS] { BooleanTest *b = makeNode(BooleanTest); b->arg = (Expr *) B; b->booltesttype = IS_FALSE; b->location = LOC(C); A = (Node *) b; } a_expr(A) ::= a_expr(B) IS NOT FALSE_P. [IS] { BooleanTest *b = makeNode(BooleanTest); b->arg = (Expr *) B; b->booltesttype = IS_NOT_FALSE; b->location = LOC(C); A = (Node *) b; } a_expr(A) ::= a_expr(B) IS UNKNOWN. [IS] { BooleanTest *b = makeNode(BooleanTest); b->arg = (Expr *) B; b->booltesttype = IS_UNKNOWN; b->location = LOC(C); A = (Node *) b; } a_expr(A) ::= a_expr(B) IS NOT UNKNOWN. [IS] { BooleanTest *b = makeNode(BooleanTest); b->arg = (Expr *) B; b->booltesttype = IS_NOT_UNKNOWN; b->location = LOC(C); A = (Node *) b; } a_expr(A) ::= a_expr(B) IS DISTINCT FROM a_expr(F). [IS] { A = (Node *) makeSimpleA_Expr(AEXPR_DISTINCT, "=", B, F, LOC(C)); } a_expr(A) ::= a_expr(B) IS NOT DISTINCT FROM a_expr(G). [IS] { A = (Node *) makeSimpleA_Expr(AEXPR_NOT_DISTINCT, "=", B, G, LOC(C)); } a_expr(A) ::= a_expr(B) BETWEEN opt_asymmetric(D) b_expr(E) AND a_expr(G). [BETWEEN] { A = (Node *) makeSimpleA_Expr(AEXPR_BETWEEN, "BETWEEN", B, (Node *) list_make2(E, G), LOC(C)); } a_expr(A) ::= a_expr(B) NOT_LA BETWEEN opt_asymmetric(E) b_expr(F) AND a_expr(H). [NOT_LA] { A = (Node *) makeSimpleA_Expr(AEXPR_NOT_BETWEEN, "NOT BETWEEN", B, (Node *) list_make2(F, H), LOC(C)); } a_expr(A) ::= a_expr(B) BETWEEN SYMMETRIC b_expr(E) AND a_expr(G). [BETWEEN] { A = (Node *) makeSimpleA_Expr(AEXPR_BETWEEN_SYM, "BETWEEN SYMMETRIC", B, (Node *) list_make2(E, G), LOC(C)); } a_expr(A) ::= a_expr(B) NOT_LA BETWEEN SYMMETRIC b_expr(F) AND a_expr(H). [NOT_LA] { A = (Node *) makeSimpleA_Expr(AEXPR_NOT_BETWEEN_SYM, "NOT BETWEEN SYMMETRIC", B, (Node *) list_make2(F, H), LOC(C)); } a_expr(A) ::= a_expr(B) IN_P select_with_parens(D). { SubLink *n = makeNode(SubLink); n->subselect = D; n->subLinkType = ANY_SUBLINK; n->subLinkId = 0; n->testexpr = B; n->operName = NIL; n->location = LOC(C); A = (Node *) n; } a_expr(A) ::= a_expr(B) IN_P LPAREN expr_list(E) RPAREN. { A_Expr *n = makeSimpleA_Expr(AEXPR_IN, "=", B, (Node *) E, LOC(C)); n->rexpr_list_start = LOC(D); n->rexpr_list_end = LOC(F); A = (Node *) n; } a_expr(A) ::= a_expr(B) NOT_LA IN_P select_with_parens(E). [NOT_LA] { SubLink *n = makeNode(SubLink); n->subselect = E; n->subLinkType = ANY_SUBLINK; n->subLinkId = 0; n->testexpr = B; n->operName = NIL; n->location = LOC(C); A = makeNotExpr((Node *) n, LOC(C)); } a_expr(A) ::= a_expr(B) NOT_LA IN_P LPAREN expr_list(F) RPAREN. { A_Expr *n = makeSimpleA_Expr(AEXPR_IN, "<>", B, (Node *) F, LOC(C)); n->rexpr_list_start = LOC(E); n->rexpr_list_end = LOC(G); A = (Node *) n; } a_expr(A) ::= a_expr(B) subquery_Op(C) sub_type(D) select_with_parens(E). [OP] { SubLink *n = makeNode(SubLink); n->subLinkType = D; n->subLinkId = 0; n->testexpr = B; n->operName = C; n->subselect = E; n->location = LOC(C); A = (Node *) n; } a_expr(A) ::= a_expr(B) subquery_Op(C) sub_type(D) LPAREN a_expr(F) RPAREN. [OP] { if (D == ANY_SUBLINK) A = (Node *) makeA_Expr(AEXPR_OP_ANY, C, B, F, LOC(C)); else A = (Node *) makeA_Expr(AEXPR_OP_ALL, C, B, F, LOC(C)); } a_expr(A) ::= UNIQUE opt_unique_null_treatment(C) select_with_parens(D). { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("UNIQUE predicate is not yet implemented"), parser_errposition(LOC(B)))); } a_expr(A) ::= a_expr(B) IS DOCUMENT_P. [IS] { A = makeXmlExpr(IS_DOCUMENT, NULL, NIL, list_make1(B), LOC(C)); } a_expr(A) ::= a_expr(B) IS NOT DOCUMENT_P. [IS] { A = makeNotExpr(makeXmlExpr(IS_DOCUMENT, NULL, NIL, list_make1(B), LOC(C)), LOC(C)); } a_expr(A) ::= a_expr(B) IS NORMALIZED. [IS] { A = (Node *) makeFuncCall(SystemFuncName("is_normalized"), list_make1(B), COERCE_SQL_SYNTAX, LOC(C)); } a_expr(A) ::= a_expr(B) IS unicode_normal_form(D) NORMALIZED. [IS] { A = (Node *) makeFuncCall(SystemFuncName("is_normalized"), list_make2(B, makeStringConst(D, LOC(D))), COERCE_SQL_SYNTAX, LOC(C)); } a_expr(A) ::= a_expr(B) IS NOT NORMALIZED. [IS] { A = makeNotExpr((Node *) makeFuncCall(SystemFuncName("is_normalized"), list_make1(B), COERCE_SQL_SYNTAX, LOC(C)), LOC(C)); } a_expr(A) ::= a_expr(B) IS NOT unicode_normal_form(E) NORMALIZED. [IS] { A = makeNotExpr((Node *) makeFuncCall(SystemFuncName("is_normalized"), list_make2(B, makeStringConst(E, LOC(E))), COERCE_SQL_SYNTAX, LOC(C)), LOC(C)); } a_expr(A) ::= a_expr(B) IS json_predicate_type_constraint(D) json_key_uniqueness_constraint_opt(E). [IS] { JsonFormat *format = makeJsonFormat(JS_FORMAT_DEFAULT, JS_ENC_DEFAULT, -1); A = makeJsonIsPredicate(B, format, D, E, InvalidOid, LOC(B)); } a_expr(A) ::= a_expr(B) IS NOT json_predicate_type_constraint(E) json_key_uniqueness_constraint_opt(F). [IS] { JsonFormat *format = makeJsonFormat(JS_FORMAT_DEFAULT, JS_ENC_DEFAULT, -1); A = makeNotExpr(makeJsonIsPredicate(B, format, E, F, InvalidOid, LOC(B)), LOC(B)); } a_expr(A) ::= DEFAULT. { SetToDefault *n = makeNode(SetToDefault); n->location = LOC(B); A = (Node *) n; } /* ----- b_expr ----- */ b_expr(A) ::= c_expr(B). { A = B; } b_expr(A) ::= b_expr(B) TYPECAST typename(D). { A = makeTypeCast(B, D, LOC(C)); } b_expr(A) ::= PLUS b_expr(C). [UMINUS] { A = (Node *) makeSimpleA_Expr(AEXPR_OP, "+", NULL, C, LOC(B)); } b_expr(A) ::= MINUS b_expr(C). [UMINUS] { A = doNegate(C, LOC(B)); } b_expr(A) ::= b_expr(B) PLUS b_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_OP, "+", B, D, LOC(C)); } b_expr(A) ::= b_expr(B) MINUS b_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_OP, "-", B, D, LOC(C)); } b_expr(A) ::= b_expr(B) STAR b_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_OP, "*", B, D, LOC(C)); } b_expr(A) ::= b_expr(B) SLASH b_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_OP, "/", B, D, LOC(C)); } b_expr(A) ::= b_expr(B) PERCENT b_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_OP, "%", B, D, LOC(C)); } b_expr(A) ::= b_expr(B) CARET b_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_OP, "^", B, D, LOC(C)); } b_expr(A) ::= b_expr(B) LT b_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_OP, "<", B, D, LOC(C)); } b_expr(A) ::= b_expr(B) GT b_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_OP, ">", B, D, LOC(C)); } b_expr(A) ::= b_expr(B) EQ b_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_OP, "=", B, D, LOC(C)); } b_expr(A) ::= b_expr(B) LESS_EQUALS b_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_OP, "<=", B, D, LOC(C)); } b_expr(A) ::= b_expr(B) GREATER_EQUALS b_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_OP, ">=", B, D, LOC(C)); } b_expr(A) ::= b_expr(B) NOT_EQUALS b_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_OP, "<>", B, D, LOC(C)); } b_expr(A) ::= b_expr(B) RIGHT_ARROW b_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_OP, "->", B, D, LOC(C)); } b_expr(A) ::= b_expr(B) PIPE b_expr(D). { A = (Node *) makeSimpleA_Expr(AEXPR_OP, "|", B, D, LOC(C)); } b_expr(A) ::= b_expr(B) qual_Op(C) b_expr(D). [OP] { A = (Node *) makeA_Expr(AEXPR_OP, C, B, D, LOC(C)); } b_expr(A) ::= qual_Op(B) b_expr(C). [OP] { A = (Node *) makeA_Expr(AEXPR_OP, B, NULL, C, LOC(B)); } b_expr(A) ::= b_expr(B) IS DISTINCT FROM b_expr(F). [IS] { A = (Node *) makeSimpleA_Expr(AEXPR_DISTINCT, "=", B, F, LOC(C)); } b_expr(A) ::= b_expr(B) IS NOT DISTINCT FROM b_expr(G). [IS] { A = (Node *) makeSimpleA_Expr(AEXPR_NOT_DISTINCT, "=", B, G, LOC(C)); } b_expr(A) ::= b_expr(B) IS DOCUMENT_P. [IS] { A = makeXmlExpr(IS_DOCUMENT, NULL, NIL, list_make1(B), LOC(C)); } b_expr(A) ::= b_expr(B) IS NOT DOCUMENT_P. [IS] { A = makeNotExpr(makeXmlExpr(IS_DOCUMENT, NULL, NIL, list_make1(B), LOC(C)), LOC(C)); } /* ----- c_expr ----- */ c_expr(A) ::= columnref(B). { A = B; } c_expr(A) ::= aexprConst(B). { A = B; } c_expr(A) ::= PARAM opt_indirection(C). { ParamRef *p = makeNode(ParamRef); p->number = B; p->location = LOC(B); if (C) { A_Indirection *n = makeNode(A_Indirection); n->arg = (Node *) p; n->indirection = check_indirection(C, yyscanner); A = (Node *) n; } else A = (Node *) p; } c_expr(A) ::= LPAREN a_expr(C) RPAREN opt_indirection(E). { if (E) { A_Indirection *n = makeNode(A_Indirection); n->arg = C; n->indirection = check_indirection(E, yyscanner); A = (Node *) n; } else A = C; } c_expr(A) ::= case_expr(B). { A = B; } c_expr(A) ::= func_expr(B). { A = B; } c_expr(A) ::= select_with_parens(B). [UMINUS] { SubLink *n = makeNode(SubLink); n->subLinkType = EXPR_SUBLINK; n->subLinkId = 0; n->testexpr = NULL; n->operName = NIL; n->subselect = B; n->location = LOC(B); A = (Node *) n; } c_expr(A) ::= select_with_parens(B) indirection(C). { SubLink *n = makeNode(SubLink); A_Indirection *a = makeNode(A_Indirection); n->subLinkType = EXPR_SUBLINK; n->subLinkId = 0; n->testexpr = NULL; n->operName = NIL; n->subselect = B; n->location = LOC(B); a->arg = (Node *) n; a->indirection = check_indirection(C, yyscanner); A = (Node *) a; } c_expr(A) ::= EXISTS select_with_parens(C). { SubLink *n = makeNode(SubLink); n->subLinkType = EXISTS_SUBLINK; n->subLinkId = 0; n->testexpr = NULL; n->operName = NIL; n->subselect = C; n->location = LOC(B); A = (Node *) n; } c_expr(A) ::= ARRAY select_with_parens(C). { SubLink *n = makeNode(SubLink); n->subLinkType = ARRAY_SUBLINK; n->subLinkId = 0; n->testexpr = NULL; n->operName = NIL; n->subselect = C; n->location = LOC(B); A = (Node *) n; } c_expr(A) ::= ARRAY array_expr(C). { A_ArrayExpr *n = castNode(A_ArrayExpr, C); n->location = LOC(B); A = (Node *) n; } c_expr(A) ::= explicit_row(B). { RowExpr *r = makeNode(RowExpr); r->args = B; r->row_typeid = InvalidOid; r->colnames = NIL; r->row_format = COERCE_EXPLICIT_CALL; r->location = LOC(B); A = (Node *) r; } c_expr(A) ::= implicit_row(B). { RowExpr *r = makeNode(RowExpr); r->args = B; r->row_typeid = InvalidOid; r->colnames = NIL; r->row_format = COERCE_IMPLICIT_CAST; r->location = LOC(B); A = (Node *) r; } c_expr(A) ::= GROUPING LPAREN expr_list(D) RPAREN. { GroupingFunc *g = makeNode(GroupingFunc); g->args = D; g->location = LOC(B); A = (Node *) g; } /* ----- func_application ----- */ func_application(A) ::= func_name(B) LPAREN RPAREN. { A = (Node *) makeFuncCall(B, NIL, COERCE_EXPLICIT_CALL, LOC(B)); } func_application(A) ::= func_name(B) LPAREN func_arg_list(D) opt_sort_clause(E) RPAREN. { FuncCall *n = makeFuncCall(B, D, COERCE_EXPLICIT_CALL, LOC(B)); n->agg_order = E; A = (Node *) n; } func_application(A) ::= func_name(B) LPAREN VARIADIC func_arg_expr(E) opt_sort_clause(F) RPAREN. { FuncCall *n = makeFuncCall(B, list_make1(E), COERCE_EXPLICIT_CALL, LOC(B)); n->func_variadic = true; n->agg_order = F; A = (Node *) n; } func_application(A) ::= func_name(B) LPAREN func_arg_list(D) COMMA VARIADIC func_arg_expr(G) opt_sort_clause(H) RPAREN. { FuncCall *n = makeFuncCall(B, lappend(D, G), COERCE_EXPLICIT_CALL, LOC(B)); n->func_variadic = true; n->agg_order = H; A = (Node *) n; } func_application(A) ::= func_name(B) LPAREN ALL func_arg_list(E) opt_sort_clause(F) RPAREN. { FuncCall *n = makeFuncCall(B, E, COERCE_EXPLICIT_CALL, LOC(B)); n->agg_order = F; A = (Node *) n; } func_application(A) ::= func_name(B) LPAREN DISTINCT func_arg_list(E) opt_sort_clause(F) RPAREN. { FuncCall *n = makeFuncCall(B, E, COERCE_EXPLICIT_CALL, LOC(B)); n->agg_order = F; n->agg_distinct = true; A = (Node *) n; } func_application(A) ::= func_name(B) LPAREN STAR RPAREN. { FuncCall *n = makeFuncCall(B, NIL, COERCE_EXPLICIT_CALL, LOC(B)); n->agg_star = true; A = (Node *) n; } /* ----- func_expr ----- */ func_expr(A) ::= func_application(B) within_group_clause(C) filter_clause(D) null_treatment(E) over_clause(F). { FuncCall *n = (FuncCall *) B; if (C != NIL) { if (n->agg_order != NIL) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("cannot use multiple ORDER BY clauses with WITHIN GROUP"), parser_errposition(LOC(C)))); if (n->agg_distinct) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("cannot use DISTINCT with WITHIN GROUP"), parser_errposition(LOC(C)))); if (n->func_variadic) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("cannot use VARIADIC with WITHIN GROUP"), parser_errposition(LOC(C)))); n->agg_order = C; n->agg_within_group = true; } n->agg_filter = D; n->ignore_nulls = E; n->over = F; A = (Node *) n; } func_expr(A) ::= json_aggregate_func(B) filter_clause(C) over_clause(D). { JsonAggConstructor *n = IsA(B, JsonObjectAgg) ? ((JsonObjectAgg *) B)->constructor : ((JsonArrayAgg *) B)->constructor; n->agg_filter = C; n->over = D; A = (Node *) B; } func_expr(A) ::= func_expr_common_subexpr(B). { A = B; } /* ----- func_expr_windowless ----- */ func_expr_windowless(A) ::= func_application(B). { A = B; } func_expr_windowless(A) ::= func_expr_common_subexpr(B). { A = B; } func_expr_windowless(A) ::= json_aggregate_func(B). { A = B; } /* ----- func_expr_common_subexpr ----- */ func_expr_common_subexpr(A) ::= COLLATION FOR LPAREN a_expr(E) RPAREN. { A = (Node *) makeFuncCall(SystemFuncName("pg_collation_for"), list_make1(E), COERCE_SQL_SYNTAX, LOC(B)); } func_expr_common_subexpr(A) ::= CURRENT_DATE. { A = makeSQLValueFunction(SVFOP_CURRENT_DATE, -1, LOC(B)); } func_expr_common_subexpr(A) ::= CURRENT_TIME. { A = makeSQLValueFunction(SVFOP_CURRENT_TIME, -1, LOC(B)); } func_expr_common_subexpr(A) ::= CURRENT_TIME LPAREN iconst(D) RPAREN. { A = makeSQLValueFunction(SVFOP_CURRENT_TIME_N, D, LOC(B)); } func_expr_common_subexpr(A) ::= CURRENT_TIMESTAMP. { A = makeSQLValueFunction(SVFOP_CURRENT_TIMESTAMP, -1, LOC(B)); } func_expr_common_subexpr(A) ::= CURRENT_TIMESTAMP LPAREN iconst(D) RPAREN. { A = makeSQLValueFunction(SVFOP_CURRENT_TIMESTAMP_N, D, LOC(B)); } func_expr_common_subexpr(A) ::= LOCALTIME. { A = makeSQLValueFunction(SVFOP_LOCALTIME, -1, LOC(B)); } func_expr_common_subexpr(A) ::= LOCALTIME LPAREN iconst(D) RPAREN. { A = makeSQLValueFunction(SVFOP_LOCALTIME_N, D, LOC(B)); } func_expr_common_subexpr(A) ::= LOCALTIMESTAMP. { A = makeSQLValueFunction(SVFOP_LOCALTIMESTAMP, -1, LOC(B)); } func_expr_common_subexpr(A) ::= LOCALTIMESTAMP LPAREN iconst(D) RPAREN. { A = makeSQLValueFunction(SVFOP_LOCALTIMESTAMP_N, D, LOC(B)); } func_expr_common_subexpr(A) ::= CURRENT_ROLE. { A = makeSQLValueFunction(SVFOP_CURRENT_ROLE, -1, LOC(B)); } func_expr_common_subexpr(A) ::= CURRENT_USER. { A = makeSQLValueFunction(SVFOP_CURRENT_USER, -1, LOC(B)); } func_expr_common_subexpr(A) ::= SESSION_USER. { A = makeSQLValueFunction(SVFOP_SESSION_USER, -1, LOC(B)); } func_expr_common_subexpr(A) ::= SYSTEM_USER. { A = (Node *) makeFuncCall(SystemFuncName("system_user"), NIL, COERCE_SQL_SYNTAX, LOC(B)); } func_expr_common_subexpr(A) ::= USER. { A = makeSQLValueFunction(SVFOP_USER, -1, LOC(B)); } func_expr_common_subexpr(A) ::= CURRENT_CATALOG. { A = makeSQLValueFunction(SVFOP_CURRENT_CATALOG, -1, LOC(B)); } func_expr_common_subexpr(A) ::= CURRENT_SCHEMA. { A = makeSQLValueFunction(SVFOP_CURRENT_SCHEMA, -1, LOC(B)); } func_expr_common_subexpr(A) ::= CAST LPAREN a_expr(D) AS typename(F) RPAREN. { A = makeTypeCast(D, F, LOC(B)); } func_expr_common_subexpr(A) ::= EXTRACT LPAREN extract_list(D) RPAREN. { A = (Node *) makeFuncCall(SystemFuncName("extract"), D, COERCE_SQL_SYNTAX, LOC(B)); } func_expr_common_subexpr(A) ::= NORMALIZE LPAREN a_expr(D) RPAREN. { A = (Node *) makeFuncCall(SystemFuncName("normalize"), list_make1(D), COERCE_SQL_SYNTAX, LOC(B)); } func_expr_common_subexpr(A) ::= NORMALIZE LPAREN a_expr(D) COMMA unicode_normal_form(F) RPAREN. { A = (Node *) makeFuncCall(SystemFuncName("normalize"), list_make2(D, makeStringConst(F, LOC(F))), COERCE_SQL_SYNTAX, LOC(B)); } func_expr_common_subexpr(A) ::= OVERLAY LPAREN overlay_list(D) RPAREN. { A = (Node *) makeFuncCall(SystemFuncName("overlay"), D, COERCE_SQL_SYNTAX, LOC(B)); } func_expr_common_subexpr(A) ::= OVERLAY LPAREN func_arg_list_opt(D) RPAREN. { A = (Node *) makeFuncCall(list_make1(makeString("overlay")), D, COERCE_EXPLICIT_CALL, LOC(B)); } func_expr_common_subexpr(A) ::= POSITION LPAREN position_list(D) RPAREN. { A = (Node *) makeFuncCall(SystemFuncName("position"), D, COERCE_SQL_SYNTAX, LOC(B)); } func_expr_common_subexpr(A) ::= SUBSTRING LPAREN substr_list(D) RPAREN. { A = (Node *) makeFuncCall(SystemFuncName("substring"), D, COERCE_SQL_SYNTAX, LOC(B)); } func_expr_common_subexpr(A) ::= SUBSTRING LPAREN func_arg_list_opt(D) RPAREN. { A = (Node *) makeFuncCall(list_make1(makeString("substring")), D, COERCE_EXPLICIT_CALL, LOC(B)); } func_expr_common_subexpr(A) ::= TREAT LPAREN a_expr(D) AS typename(F) RPAREN. { A = (Node *) makeFuncCall(SystemFuncName(strVal(llast(F->names))), list_make1(D), COERCE_EXPLICIT_CALL, LOC(B)); } func_expr_common_subexpr(A) ::= TRIM LPAREN BOTH trim_list(E) RPAREN. { A = (Node *) makeFuncCall(SystemFuncName("btrim"), E, COERCE_SQL_SYNTAX, LOC(B)); } func_expr_common_subexpr(A) ::= TRIM LPAREN LEADING trim_list(E) RPAREN. { A = (Node *) makeFuncCall(SystemFuncName("ltrim"), E, COERCE_SQL_SYNTAX, LOC(B)); } func_expr_common_subexpr(A) ::= TRIM LPAREN TRAILING trim_list(E) RPAREN. { A = (Node *) makeFuncCall(SystemFuncName("rtrim"), E, COERCE_SQL_SYNTAX, LOC(B)); } func_expr_common_subexpr(A) ::= TRIM LPAREN trim_list(D) RPAREN. { A = (Node *) makeFuncCall(SystemFuncName("btrim"), D, COERCE_SQL_SYNTAX, LOC(B)); } func_expr_common_subexpr(A) ::= NULLIF LPAREN a_expr(D) COMMA a_expr(F) RPAREN. { A = (Node *) makeSimpleA_Expr(AEXPR_NULLIF, "=", D, F, LOC(B)); } func_expr_common_subexpr(A) ::= COALESCE LPAREN expr_list(D) RPAREN. { CoalesceExpr *c = makeNode(CoalesceExpr); c->args = D; c->location = LOC(B); A = (Node *) c; } func_expr_common_subexpr(A) ::= GREATEST LPAREN expr_list(D) RPAREN. { MinMaxExpr *v = makeNode(MinMaxExpr); v->args = D; v->op = IS_GREATEST; v->location = LOC(B); A = (Node *) v; } func_expr_common_subexpr(A) ::= LEAST LPAREN expr_list(D) RPAREN. { MinMaxExpr *v = makeNode(MinMaxExpr); v->args = D; v->op = IS_LEAST; v->location = LOC(B); A = (Node *) v; } func_expr_common_subexpr(A) ::= XMLCONCAT LPAREN expr_list(D) RPAREN. { A = makeXmlExpr(IS_XMLCONCAT, NULL, NIL, D, LOC(B)); } func_expr_common_subexpr(A) ::= XMLELEMENT LPAREN NAME_P colLabel(E) RPAREN. { A = makeXmlExpr(IS_XMLELEMENT, E, NIL, NIL, LOC(B)); } func_expr_common_subexpr(A) ::= XMLELEMENT LPAREN NAME_P colLabel(E) COMMA xml_attributes(G) RPAREN. { A = makeXmlExpr(IS_XMLELEMENT, E, G, NIL, LOC(B)); } func_expr_common_subexpr(A) ::= XMLELEMENT LPAREN NAME_P colLabel(E) COMMA expr_list(G) RPAREN. { A = makeXmlExpr(IS_XMLELEMENT, E, NIL, G, LOC(B)); } func_expr_common_subexpr(A) ::= XMLELEMENT LPAREN NAME_P colLabel(E) COMMA xml_attributes(G) COMMA expr_list(I) RPAREN. { A = makeXmlExpr(IS_XMLELEMENT, E, G, I, LOC(B)); } func_expr_common_subexpr(A) ::= XMLEXISTS LPAREN c_expr(D) xmlexists_argument(E) RPAREN. { A = (Node *) makeFuncCall(SystemFuncName("xmlexists"), list_make2(D, E), COERCE_SQL_SYNTAX, LOC(B)); } func_expr_common_subexpr(A) ::= XMLFOREST LPAREN labeled_expr_list(D) RPAREN. { A = makeXmlExpr(IS_XMLFOREST, NULL, D, NIL, LOC(B)); } func_expr_common_subexpr(A) ::= XMLPARSE LPAREN document_or_content(D) a_expr(E) xml_whitespace_option(F) RPAREN. { XmlExpr *x = (XmlExpr *) makeXmlExpr(IS_XMLPARSE, NULL, NIL, list_make2(E, makeBoolAConst(F, -1)), LOC(B)); x->xmloption = D; A = (Node *) x; } func_expr_common_subexpr(A) ::= XMLPI LPAREN NAME_P colLabel(E) RPAREN. { A = makeXmlExpr(IS_XMLPI, E, NULL, NIL, LOC(B)); } func_expr_common_subexpr(A) ::= XMLPI LPAREN NAME_P colLabel(E) COMMA a_expr(G) RPAREN. { A = makeXmlExpr(IS_XMLPI, E, NULL, list_make1(G), LOC(B)); } func_expr_common_subexpr(A) ::= XMLROOT LPAREN a_expr(D) COMMA xml_root_version(F) opt_xml_root_standalone(G) RPAREN. { A = makeXmlExpr(IS_XMLROOT, NULL, NIL, list_make3(D, F, G), LOC(B)); } func_expr_common_subexpr(A) ::= XMLSERIALIZE LPAREN document_or_content(D) a_expr(E) AS simpleTypename(G) xml_indent_option(H) RPAREN. { XmlSerialize *n = makeNode(XmlSerialize); n->xmloption = D; n->expr = E; n->typeName = G; n->indent = H; n->location = LOC(B); A = (Node *) n; } func_expr_common_subexpr(A) ::= JSON_OBJECT LPAREN func_arg_list(D) RPAREN. { A = (Node *) makeFuncCall(SystemFuncName("json_object"), D, COERCE_EXPLICIT_CALL, LOC(B)); } func_expr_common_subexpr(A) ::= JSON_OBJECT LPAREN json_name_and_value_list(D) json_object_constructor_null_clause_opt(E) json_key_uniqueness_constraint_opt(F) json_returning_clause_opt(G) RPAREN. { JsonObjectConstructor *n = makeNode(JsonObjectConstructor); n->exprs = D; n->absent_on_null = E; n->unique = F; n->output = (JsonOutput *) G; n->location = LOC(B); A = (Node *) n; } func_expr_common_subexpr(A) ::= JSON_OBJECT LPAREN json_returning_clause_opt(D) RPAREN. { JsonObjectConstructor *n = makeNode(JsonObjectConstructor); n->exprs = NULL; n->absent_on_null = false; n->unique = false; n->output = (JsonOutput *) D; n->location = LOC(B); A = (Node *) n; } func_expr_common_subexpr(A) ::= JSON_ARRAY LPAREN json_value_expr_list(D) json_array_constructor_null_clause_opt(E) json_returning_clause_opt(F) RPAREN. { JsonArrayConstructor *n = makeNode(JsonArrayConstructor); n->exprs = D; n->absent_on_null = E; n->output = (JsonOutput *) F; n->location = LOC(B); A = (Node *) n; } func_expr_common_subexpr(A) ::= JSON_ARRAY LPAREN select_no_parens(D) json_format_clause_opt(E) json_returning_clause_opt(F) RPAREN. { JsonArrayQueryConstructor *n = makeNode(JsonArrayQueryConstructor); n->query = D; n->format = (JsonFormat *) E; n->absent_on_null = true; n->output = (JsonOutput *) F; n->location = LOC(B); A = (Node *) n; } func_expr_common_subexpr(A) ::= JSON_ARRAY LPAREN json_returning_clause_opt(D) RPAREN. { JsonArrayConstructor *n = makeNode(JsonArrayConstructor); n->exprs = NIL; n->absent_on_null = true; n->output = (JsonOutput *) D; n->location = LOC(B); A = (Node *) n; } func_expr_common_subexpr(A) ::= JSON LPAREN json_value_expr(D) json_key_uniqueness_constraint_opt(E) RPAREN. { JsonParseExpr *n = makeNode(JsonParseExpr); n->expr = (JsonValueExpr *) D; n->unique_keys = E; n->output = NULL; n->location = LOC(B); A = (Node *) n; } func_expr_common_subexpr(A) ::= JSON_SCALAR LPAREN a_expr(D) RPAREN. { JsonScalarExpr *n = makeNode(JsonScalarExpr); n->expr = (Expr *) D; n->output = NULL; n->location = LOC(B); A = (Node *) n; } func_expr_common_subexpr(A) ::= JSON_SERIALIZE LPAREN json_value_expr(D) json_returning_clause_opt(E) RPAREN. { JsonSerializeExpr *n = makeNode(JsonSerializeExpr); n->expr = (JsonValueExpr *) D; n->output = (JsonOutput *) E; n->location = LOC(B); A = (Node *) n; } func_expr_common_subexpr(A) ::= MERGE_ACTION LPAREN RPAREN. { MergeSupportFunc *m = makeNode(MergeSupportFunc); m->msftype = TEXTOID; m->location = LOC(B); A = (Node *) m; } func_expr_common_subexpr(A) ::= JSON_QUERY LPAREN json_value_expr(D) COMMA a_expr(F) json_passing_clause_opt(G) json_returning_clause_opt(H) json_wrapper_behavior(I) json_quotes_clause_opt(J) json_behavior_clause_opt(K) RPAREN. { JsonFuncExpr *n = makeNode(JsonFuncExpr); n->op = JSON_QUERY_OP; n->context_item = (JsonValueExpr *) D; n->pathspec = F; n->passing = G; n->output = (JsonOutput *) H; n->wrapper = I; n->quotes = J; n->on_empty = (JsonBehavior *) linitial(K); n->on_error = (JsonBehavior *) lsecond(K); n->location = LOC(B); A = (Node *) n; } func_expr_common_subexpr(A) ::= JSON_EXISTS LPAREN json_value_expr(D) COMMA a_expr(F) json_passing_clause_opt(G) json_on_error_clause_opt(H) RPAREN. { JsonFuncExpr *n = makeNode(JsonFuncExpr); n->op = JSON_EXISTS_OP; n->context_item = (JsonValueExpr *) D; n->pathspec = F; n->passing = G; n->output = NULL; n->on_error = (JsonBehavior *) H; n->location = LOC(B); A = (Node *) n; } func_expr_common_subexpr(A) ::= JSON_VALUE LPAREN json_value_expr(D) COMMA a_expr(F) json_passing_clause_opt(G) json_returning_clause_opt(H) json_behavior_clause_opt(I) RPAREN. { JsonFuncExpr *n = makeNode(JsonFuncExpr); n->op = JSON_VALUE_OP; n->context_item = (JsonValueExpr *) D; n->pathspec = F; n->passing = G; n->output = (JsonOutput *) H; n->on_empty = (JsonBehavior *) linitial(I); n->on_error = (JsonBehavior *) lsecond(I); n->location = LOC(B); A = (Node *) n; } /* ----- xml_root_version ----- */ xml_root_version(A) ::= VERSION_P a_expr(C). { A = C; } xml_root_version(A) ::= VERSION_P NO VALUE_P. { A = makeNullAConst(-1); } /* ----- opt_xml_root_standalone ----- */ opt_xml_root_standalone(A) ::= COMMA STANDALONE_P YES_P. { A = makeIntConst(XML_STANDALONE_YES, -1); } opt_xml_root_standalone(A) ::= COMMA STANDALONE_P NO. { A = makeIntConst(XML_STANDALONE_NO, -1); } opt_xml_root_standalone(A) ::= COMMA STANDALONE_P NO VALUE_P. { A = makeIntConst(XML_STANDALONE_NO_VALUE, -1); } opt_xml_root_standalone(A) ::= . { A = makeIntConst(XML_STANDALONE_OMITTED, -1); } /* ----- xml_attributes ----- */ xml_attributes(A) ::= XMLATTRIBUTES LPAREN labeled_expr_list(D) RPAREN. { A = D; } /* ----- labeled_expr_list ----- */ labeled_expr_list(A) ::= labeled_expr(B). { A = list_make1(B); } labeled_expr_list(A) ::= labeled_expr_list(B) COMMA labeled_expr(D). { A = lappend(B, D); } /* ----- labeled_expr ----- */ labeled_expr(A) ::= a_expr(B) AS colLabel(D). { A = makeNode(ResTarget); A->name = D; A->indirection = NIL; A->val = (Node *) B; A->location = LOC(B); } labeled_expr(A) ::= a_expr(B). { A = makeNode(ResTarget); A->name = NULL; A->indirection = NIL; A->val = (Node *) B; A->location = LOC(B); } /* ----- document_or_content ----- */ document_or_content(A) ::= DOCUMENT_P. { A = XMLOPTION_DOCUMENT; } document_or_content(A) ::= CONTENT_P. { A = XMLOPTION_CONTENT; } /* ----- xml_indent_option ----- */ xml_indent_option(A) ::= INDENT. { A = true; } xml_indent_option(A) ::= NO INDENT. { A = false; } xml_indent_option(A) ::= . { A = false; } /* ----- xml_whitespace_option ----- */ xml_whitespace_option(A) ::= PRESERVE WHITESPACE_P. { A = true; } xml_whitespace_option(A) ::= STRIP_P WHITESPACE_P. { A = false; } xml_whitespace_option(A) ::= . { A = false; } /* ----- xmlexists_argument ----- */ xmlexists_argument(A) ::= PASSING c_expr(C). { A = C; } xmlexists_argument(A) ::= PASSING c_expr(C) xml_passing_mech(D). { A = C; } xmlexists_argument(A) ::= PASSING xml_passing_mech(C) c_expr(D). { A = D; } xmlexists_argument(A) ::= PASSING xml_passing_mech(C) c_expr(D) xml_passing_mech(E). { A = D; } /* ----- xml_passing_mech ----- */ xml_passing_mech(A) ::= BY REF_P. xml_passing_mech(A) ::= BY VALUE_P. /* ----- waitStmt ----- */ waitStmt(A) ::= WAIT FOR LSN_P sconst(E) opt_wait_with_clause(F). { waitStmt *n = makeNode(waitStmt); n->lsn_literal = E; n->options = F; A = (Node *) n; } /* ----- opt_wait_with_clause ----- */ opt_wait_with_clause(A) ::= WITH LPAREN utility_option_list(D) RPAREN. { A = D; } opt_wait_with_clause(A) ::= . { A = NIL; } /* ----- within_group_clause ----- */ within_group_clause(A) ::= WITHIN GROUP_P LPAREN sort_clause(E) RPAREN. { A = E; } within_group_clause(A) ::= . { A = NIL; } /* ----- filter_clause ----- */ filter_clause(A) ::= FILTER LPAREN WHERE a_expr(E) RPAREN. { A = E; } filter_clause(A) ::= . { A = NULL; } /* ----- null_treatment ----- */ null_treatment(A) ::= IGNORE_P NULLS_P. { A = PARSER_IGNORE_NULLS; } null_treatment(A) ::= RESPECT_P NULLS_P. { A = PARSER_RESPECT_NULLS; } null_treatment(A) ::= . { A = NO_NULLTREATMENT; } /* ----- window_clause ----- */ window_clause(A) ::= WINDOW window_definition_list(C). { A = C; } window_clause(A) ::= . { A = NIL; } /* ----- window_definition_list ----- */ window_definition_list(A) ::= window_definition(B). { A = list_make1(B); } window_definition_list(A) ::= window_definition_list(B) COMMA window_definition(D). { A = lappend(B, D); } /* ----- window_definition ----- */ window_definition(A) ::= colId(B) AS window_specification(D). { WindowDef *n = D; n->name = B; A = n; } /* ----- over_clause ----- */ over_clause(A) ::= OVER window_specification(C). { A = C; } over_clause(A) ::= OVER colId(C). { WindowDef *n = makeNode(WindowDef); n->name = C; n->refname = NULL; n->partitionClause = NIL; n->orderClause = NIL; n->frameOptions = FRAMEOPTION_DEFAULTS; n->startOffset = NULL; n->endOffset = NULL; n->location = LOC(C); A = n; } over_clause(A) ::= . { A = NULL; } /* ----- window_specification ----- */ window_specification(A) ::= LPAREN opt_existing_window_name(C) opt_partition_clause(D) opt_sort_clause(E) opt_frame_clause(F) RPAREN. { WindowDef *n = makeNode(WindowDef); n->name = NULL; n->refname = C; n->partitionClause = D; n->orderClause = E; n->frameOptions = F->frameOptions; n->startOffset = F->startOffset; n->endOffset = F->endOffset; n->location = LOC(B); A = n; } /* ----- opt_existing_window_name ----- */ opt_existing_window_name(A) ::= colId(B). { A = B; } opt_existing_window_name(A) ::= . [OP] { A = NULL; } /* ----- opt_partition_clause ----- */ opt_partition_clause(A) ::= PARTITION BY expr_list(D). { A = D; } opt_partition_clause(A) ::= . { A = NIL; } /* ----- opt_frame_clause ----- */ opt_frame_clause(A) ::= RANGE frame_extent(C) opt_window_exclusion_clause(D). { WindowDef *n = C; n->frameOptions |= FRAMEOPTION_NONDEFAULT | FRAMEOPTION_RANGE; n->frameOptions |= D; A = n; } opt_frame_clause(A) ::= ROWS frame_extent(C) opt_window_exclusion_clause(D). { WindowDef *n = C; n->frameOptions |= FRAMEOPTION_NONDEFAULT | FRAMEOPTION_ROWS; n->frameOptions |= D; A = n; } opt_frame_clause(A) ::= GROUPS frame_extent(C) opt_window_exclusion_clause(D). { WindowDef *n = C; n->frameOptions |= FRAMEOPTION_NONDEFAULT | FRAMEOPTION_GROUPS; n->frameOptions |= D; A = n; } opt_frame_clause(A) ::= . { WindowDef *n = makeNode(WindowDef); n->frameOptions = FRAMEOPTION_DEFAULTS; n->startOffset = NULL; n->endOffset = NULL; A = n; } /* ----- frame_extent ----- */ frame_extent(A) ::= frame_bound(B). { WindowDef *n = B; if (n->frameOptions & FRAMEOPTION_START_UNBOUNDED_FOLLOWING) ereport(ERROR, (errcode(ERRCODE_WINDOWING_ERROR), errmsg("frame start cannot be UNBOUNDED FOLLOWING"), parser_errposition(LOC(B)))); if (n->frameOptions & FRAMEOPTION_START_OFFSET_FOLLOWING) ereport(ERROR, (errcode(ERRCODE_WINDOWING_ERROR), errmsg("frame starting from following row cannot end with current row"), parser_errposition(LOC(B)))); n->frameOptions |= FRAMEOPTION_END_CURRENT_ROW; A = n; } frame_extent(A) ::= BETWEEN frame_bound(C) AND frame_bound(E). { WindowDef *n1 = C; WindowDef *n2 = E; int frameOptions = n1->frameOptions; frameOptions |= n2->frameOptions << 1; frameOptions |= FRAMEOPTION_BETWEEN; if (frameOptions & FRAMEOPTION_START_UNBOUNDED_FOLLOWING) ereport(ERROR, (errcode(ERRCODE_WINDOWING_ERROR), errmsg("frame start cannot be UNBOUNDED FOLLOWING"), parser_errposition(LOC(C)))); if (frameOptions & FRAMEOPTION_END_UNBOUNDED_PRECEDING) ereport(ERROR, (errcode(ERRCODE_WINDOWING_ERROR), errmsg("frame end cannot be UNBOUNDED PRECEDING"), parser_errposition(LOC(E)))); if ((frameOptions & FRAMEOPTION_START_CURRENT_ROW) && (frameOptions & FRAMEOPTION_END_OFFSET_PRECEDING)) ereport(ERROR, (errcode(ERRCODE_WINDOWING_ERROR), errmsg("frame starting from current row cannot have preceding rows"), parser_errposition(LOC(E)))); if ((frameOptions & FRAMEOPTION_START_OFFSET_FOLLOWING) && (frameOptions & (FRAMEOPTION_END_OFFSET_PRECEDING | FRAMEOPTION_END_CURRENT_ROW))) ereport(ERROR, (errcode(ERRCODE_WINDOWING_ERROR), errmsg("frame starting from following row cannot have preceding rows"), parser_errposition(LOC(E)))); n1->frameOptions = frameOptions; n1->endOffset = n2->startOffset; A = n1; } /* ----- frame_bound ----- */ frame_bound(A) ::= UNBOUNDED PRECEDING. { WindowDef *n = makeNode(WindowDef); n->frameOptions = FRAMEOPTION_START_UNBOUNDED_PRECEDING; n->startOffset = NULL; n->endOffset = NULL; A = n; } frame_bound(A) ::= UNBOUNDED FOLLOWING. { WindowDef *n = makeNode(WindowDef); n->frameOptions = FRAMEOPTION_START_UNBOUNDED_FOLLOWING; n->startOffset = NULL; n->endOffset = NULL; A = n; } frame_bound(A) ::= CURRENT_P ROW. { WindowDef *n = makeNode(WindowDef); n->frameOptions = FRAMEOPTION_START_CURRENT_ROW; n->startOffset = NULL; n->endOffset = NULL; A = n; } frame_bound(A) ::= a_expr(B) PRECEDING. { WindowDef *n = makeNode(WindowDef); n->frameOptions = FRAMEOPTION_START_OFFSET_PRECEDING; n->startOffset = B; n->endOffset = NULL; A = n; } frame_bound(A) ::= a_expr(B) FOLLOWING. { WindowDef *n = makeNode(WindowDef); n->frameOptions = FRAMEOPTION_START_OFFSET_FOLLOWING; n->startOffset = B; n->endOffset = NULL; A = n; } /* ----- opt_window_exclusion_clause ----- */ opt_window_exclusion_clause(A) ::= EXCLUDE CURRENT_P ROW. { A = FRAMEOPTION_EXCLUDE_CURRENT_ROW; } opt_window_exclusion_clause(A) ::= EXCLUDE GROUP_P. { A = FRAMEOPTION_EXCLUDE_GROUP; } opt_window_exclusion_clause(A) ::= EXCLUDE TIES. { A = FRAMEOPTION_EXCLUDE_TIES; } opt_window_exclusion_clause(A) ::= EXCLUDE NO OTHERS. { A = 0; } opt_window_exclusion_clause(A) ::= . { A = 0; } /* ----- row ----- */ row(A) ::= ROW LPAREN expr_list(D) RPAREN. { A = D; } row(A) ::= ROW LPAREN RPAREN. { A = NIL; } row(A) ::= LPAREN expr_list(C) COMMA a_expr(E) RPAREN. { A = lappend(C, E); } /* ----- explicit_row ----- */ explicit_row(A) ::= ROW LPAREN expr_list(D) RPAREN. { A = D; } explicit_row(A) ::= ROW LPAREN RPAREN. { A = NIL; } /* ----- implicit_row ----- */ implicit_row(A) ::= LPAREN expr_list(C) COMMA a_expr(E) RPAREN. { A = lappend(C, E); } /* ----- sub_type ----- */ sub_type(A) ::= ANY. { A = ANY_SUBLINK; } sub_type(A) ::= SOME. { A = ANY_SUBLINK; } sub_type(A) ::= ALL. { A = ALL_SUBLINK; } /* ----- all_Op ----- */ all_Op(A) ::= OP(B). { A = B; } all_Op(A) ::= mathOp(B). { A = B; } /* ----- mathOp ----- */ mathOp(A) ::= PLUS. { A = "+"; } mathOp(A) ::= MINUS. { A = "-"; } mathOp(A) ::= STAR. { A = "*"; } mathOp(A) ::= SLASH. { A = "/"; } mathOp(A) ::= PERCENT. { A = "%"; } mathOp(A) ::= CARET. { A = "^"; } mathOp(A) ::= LT. { A = "<"; } mathOp(A) ::= GT. { A = ">"; } mathOp(A) ::= EQ. { A = "="; } mathOp(A) ::= LESS_EQUALS. { A = "<="; } mathOp(A) ::= GREATER_EQUALS. { A = ">="; } mathOp(A) ::= NOT_EQUALS. { A = "<>"; } mathOp(A) ::= RIGHT_ARROW. { A = "->"; } mathOp(A) ::= PIPE. { A = "|"; } /* ----- qual_Op ----- */ qual_Op(A) ::= OP(B). { A = list_make1(makeString(B)); } qual_Op(A) ::= OPERATOR LPAREN any_operator(D) RPAREN. { A = D; } /* ----- qual_all_Op ----- */ qual_all_Op(A) ::= all_Op(B). { A = list_make1(makeString(B)); } qual_all_Op(A) ::= OPERATOR LPAREN any_operator(D) RPAREN. { A = D; } /* ----- subquery_Op ----- */ subquery_Op(A) ::= all_Op(B). { A = list_make1(makeString(B)); } subquery_Op(A) ::= OPERATOR LPAREN any_operator(D) RPAREN. { A = D; } subquery_Op(A) ::= LIKE. { A = list_make1(makeString("~~")); } subquery_Op(A) ::= NOT_LA LIKE. { A = list_make1(makeString("!~~")); } subquery_Op(A) ::= ILIKE. { A = list_make1(makeString("~~*")); } subquery_Op(A) ::= NOT_LA ILIKE. { A = list_make1(makeString("!~~*")); } /* ----- expr_list ----- */ expr_list(A) ::= a_expr(B). { A = list_make1(B); } expr_list(A) ::= expr_list(B) COMMA a_expr(D). { A = lappend(B, D); } /* ----- func_arg_list ----- */ func_arg_list(A) ::= func_arg_expr(B). { A = list_make1(B); } func_arg_list(A) ::= func_arg_list(B) COMMA func_arg_expr(D). { A = lappend(B, D); } /* ----- func_arg_expr ----- */ func_arg_expr(A) ::= a_expr(B). { A = B; } func_arg_expr(A) ::= param_name(B) COLON_EQUALS a_expr(D). { NamedArgExpr *na = makeNode(NamedArgExpr); na->name = B; na->arg = (Expr *) D; na->argnumber = -1; na->location = LOC(B); A = (Node *) na; } func_arg_expr(A) ::= param_name(B) EQUALS_GREATER a_expr(D). { NamedArgExpr *na = makeNode(NamedArgExpr); na->name = B; na->arg = (Expr *) D; na->argnumber = -1; na->location = LOC(B); A = (Node *) na; } /* ----- func_arg_list_opt ----- */ func_arg_list_opt(A) ::= func_arg_list(B). { A = B; } func_arg_list_opt(A) ::= . { A = NIL; } /* ----- type_list ----- */ type_list(A) ::= typename(B). { A = list_make1(B); } type_list(A) ::= type_list(B) COMMA typename(D). { A = lappend(B, D); } /* ----- array_expr ----- */ array_expr(A) ::= LBRACKET expr_list(C) RBRACKET. { A = makeAArrayExpr(C, LOC(B), LOC(D)); } array_expr(A) ::= LBRACKET array_expr_list(C) RBRACKET. { A = makeAArrayExpr(C, LOC(B), LOC(D)); } array_expr(A) ::= LBRACKET RBRACKET. { A = makeAArrayExpr(NIL, LOC(B), LOC(C)); } /* ----- array_expr_list ----- */ array_expr_list(A) ::= array_expr(B). { A = list_make1(B); } array_expr_list(A) ::= array_expr_list(B) COMMA array_expr(D). { A = lappend(B, D); } /* ----- extract_list ----- */ extract_list(A) ::= extract_arg(B) FROM a_expr(D). { A = list_make2(makeStringConst(B, LOC(B)), D); } /* ----- extract_arg ----- */ extract_arg(A) ::= IDENT. { A = B; } extract_arg(A) ::= YEAR_P. { A = "year"; } extract_arg(A) ::= MONTH_P. { A = "month"; } extract_arg(A) ::= DAY_P. { A = "day"; } extract_arg(A) ::= HOUR_P. { A = "hour"; } extract_arg(A) ::= MINUTE_P. { A = "minute"; } extract_arg(A) ::= SECOND_P. { A = "second"; } extract_arg(A) ::= sconst(B). { A = B; } /* ----- unicode_normal_form ----- */ unicode_normal_form(A) ::= NFC. { A = "NFC"; } unicode_normal_form(A) ::= NFD. { A = "NFD"; } unicode_normal_form(A) ::= NFKC. { A = "NFKC"; } unicode_normal_form(A) ::= NFKD. { A = "NFKD"; } /* ----- overlay_list ----- */ overlay_list(A) ::= a_expr(B) PLACING a_expr(D) FROM a_expr(F) FOR a_expr(H). { A = list_make4(B, D, F, H); } overlay_list(A) ::= a_expr(B) PLACING a_expr(D) FROM a_expr(F). { A = list_make3(B, D, F); } /* ----- position_list ----- */ position_list(A) ::= b_expr(B) IN_P b_expr(D). { A = list_make2(D, B); } /* ----- substr_list ----- */ substr_list(A) ::= a_expr(B) FROM a_expr(D) FOR a_expr(F). { A = list_make3(B, D, F); } substr_list(A) ::= a_expr(B) FOR a_expr(D) FROM a_expr(F). { A = list_make3(B, F, D); } substr_list(A) ::= a_expr(B) FROM a_expr(D). { A = list_make2(B, D); } substr_list(A) ::= a_expr(B) FOR a_expr(D). { A = list_make3(B, makeIntConst(1, -1), makeTypeCast(D, SystemTypeName("int4"), -1)); } substr_list(A) ::= a_expr(B) SIMILAR a_expr(D) ESCAPE a_expr(F). { A = list_make3(B, D, F); } /* ----- trim_list ----- */ trim_list(A) ::= a_expr(B) FROM expr_list(D). { A = lappend(D, B); } trim_list(A) ::= FROM expr_list(C). { A = C; } trim_list(A) ::= expr_list(B). { A = B; } /* ----- case_expr ----- */ case_expr(A) ::= CASE case_arg(C) when_clause_list(D) case_default(E) END_P. { CaseExpr *c = makeNode(CaseExpr); c->casetype = InvalidOid; c->arg = (Expr *) C; c->args = D; c->defresult = (Expr *) E; c->location = LOC(B); A = (Node *) c; } /* ----- when_clause_list ----- */ when_clause_list(A) ::= when_clause(B). { A = list_make1(B); } when_clause_list(A) ::= when_clause_list(B) when_clause(C). { A = lappend(B, C); } /* ----- when_clause ----- */ when_clause(A) ::= WHEN a_expr(C) THEN a_expr(E). { CaseWhen *w = makeNode(CaseWhen); w->expr = (Expr *) C; w->result = (Expr *) E; w->location = LOC(B); A = (Node *) w; } /* ----- case_default ----- */ case_default(A) ::= ELSE a_expr(C). { A = C; } case_default(A) ::= . { A = NULL; } /* ----- case_arg ----- */ case_arg(A) ::= a_expr(B). { A = B; } case_arg(A) ::= . { A = NULL; } /* ----- columnref ----- */ columnref(A) ::= colId(B). { A = makeColumnRef(B, NIL, LOC(B), yyscanner); } columnref(A) ::= colId(B) indirection(C). { A = makeColumnRef(B, C, LOC(B), yyscanner); } /* ----- indirection_el ----- */ indirection_el(A) ::= DOT attr_name(C). { A = (Node *) makeString(C); } indirection_el(A) ::= DOT STAR. { A = (Node *) makeNode(A_Star); } indirection_el(A) ::= LBRACKET a_expr(C) RBRACKET. { A_Indices *ai = makeNode(A_Indices); ai->is_slice = false; ai->lidx = NULL; ai->uidx = C; A = (Node *) ai; } indirection_el(A) ::= LBRACKET opt_slice_bound(C) COLON opt_slice_bound(E) RBRACKET. { A_Indices *ai = makeNode(A_Indices); ai->is_slice = true; ai->lidx = C; ai->uidx = E; A = (Node *) ai; } /* ----- opt_slice_bound ----- */ opt_slice_bound(A) ::= a_expr(B). { A = B; } opt_slice_bound(A) ::= . { A = NULL; } /* ----- indirection ----- */ indirection(A) ::= indirection_el(B). { A = list_make1(B); } indirection(A) ::= indirection(B) indirection_el(C). { A = lappend(B, C); } /* ----- opt_indirection ----- */ opt_indirection(A) ::= . { A = NIL; } opt_indirection(A) ::= opt_indirection(B) indirection_el(C). { A = lappend(B, C); } /* ----- opt_asymmetric ----- */ opt_asymmetric(A) ::= ASYMMETRIC. /* ----- json_passing_clause_opt ----- */ json_passing_clause_opt(A) ::= PASSING json_arguments(C). { A = C; } json_passing_clause_opt(A) ::= . { A = NIL; } /* ----- json_arguments ----- */ json_arguments(A) ::= json_argument(B). { A = list_make1(B); } json_arguments(A) ::= json_arguments(B) COMMA json_argument(D). { A = lappend(B, D); } /* ----- json_argument ----- */ json_argument(A) ::= json_value_expr(B) AS colLabel(D). { JsonArgument *n = makeNode(JsonArgument); n->val = (JsonValueExpr *) B; n->name = D; A = (Node *) n; } /* ----- json_wrapper_behavior ----- */ json_wrapper_behavior(A) ::= WITHOUT WRAPPER. { A = JSW_NONE; } json_wrapper_behavior(A) ::= WITHOUT ARRAY WRAPPER. { A = JSW_NONE; } json_wrapper_behavior(A) ::= WITH WRAPPER. { A = JSW_UNCONDITIONAL; } json_wrapper_behavior(A) ::= WITH ARRAY WRAPPER. { A = JSW_UNCONDITIONAL; } json_wrapper_behavior(A) ::= WITH CONDITIONAL ARRAY WRAPPER. { A = JSW_CONDITIONAL; } json_wrapper_behavior(A) ::= WITH UNCONDITIONAL ARRAY WRAPPER. { A = JSW_UNCONDITIONAL; } json_wrapper_behavior(A) ::= WITH CONDITIONAL WRAPPER. { A = JSW_CONDITIONAL; } json_wrapper_behavior(A) ::= WITH UNCONDITIONAL WRAPPER. { A = JSW_UNCONDITIONAL; } json_wrapper_behavior(A) ::= . { A = JSW_UNSPEC; } /* ----- json_behavior ----- */ json_behavior(A) ::= DEFAULT a_expr(C). { A = (Node *) makeJsonBehavior(JSON_BEHAVIOR_DEFAULT, C, LOC(B)); } json_behavior(A) ::= json_behavior_type(B). { A = (Node *) makeJsonBehavior(B, NULL, LOC(B)); } /* ----- json_behavior_type ----- */ json_behavior_type(A) ::= ERROR_P. { A = JSON_BEHAVIOR_ERROR; } json_behavior_type(A) ::= NULL_P. { A = JSON_BEHAVIOR_NULL; } json_behavior_type(A) ::= TRUE_P. { A = JSON_BEHAVIOR_TRUE; } json_behavior_type(A) ::= FALSE_P. { A = JSON_BEHAVIOR_FALSE; } json_behavior_type(A) ::= UNKNOWN. { A = JSON_BEHAVIOR_UNKNOWN; } json_behavior_type(A) ::= EMPTY_P ARRAY. { A = JSON_BEHAVIOR_EMPTY_ARRAY; } json_behavior_type(A) ::= EMPTY_P OBJECT_P. { A = JSON_BEHAVIOR_EMPTY_OBJECT; } json_behavior_type(A) ::= EMPTY_P. { A = JSON_BEHAVIOR_EMPTY_ARRAY; } /* ----- json_behavior_clause_opt ----- */ json_behavior_clause_opt(A) ::= json_behavior(B) ON EMPTY_P. { A = list_make2(B, NULL); } json_behavior_clause_opt(A) ::= json_behavior(B) ON ERROR_P. { A = list_make2(NULL, B); } json_behavior_clause_opt(A) ::= json_behavior(B) ON EMPTY_P json_behavior(E) ON ERROR_P. { A = list_make2(B, E); } json_behavior_clause_opt(A) ::= . { A = list_make2(NULL, NULL); } /* ----- json_on_error_clause_opt ----- */ json_on_error_clause_opt(A) ::= json_behavior(B) ON ERROR_P. { A = B; } json_on_error_clause_opt(A) ::= . { A = NULL; } /* ----- json_value_expr ----- */ json_value_expr(A) ::= a_expr(B) json_format_clause_opt(C). { A = (Node *) makeJsonValueExpr((Expr *) B, NULL, castNode(JsonFormat, C)); } /* ----- json_format_clause ----- */ json_format_clause(A) ::= FORMAT_LA JSON ENCODING name(E). { int encoding; if (!pg_strcasecmp(E, "utf8")) encoding = JS_ENC_UTF8; else if (!pg_strcasecmp(E, "utf16")) encoding = JS_ENC_UTF16; else if (!pg_strcasecmp(E, "utf32")) encoding = JS_ENC_UTF32; else ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("unrecognized JSON encoding: %s", E), parser_errposition(LOC(E)))); A = (Node *) makeJsonFormat(JS_FORMAT_JSON, encoding, LOC(B)); } json_format_clause(A) ::= FORMAT_LA JSON. { A = (Node *) makeJsonFormat(JS_FORMAT_JSON, JS_ENC_DEFAULT, LOC(B)); } /* ----- json_format_clause_opt ----- */ json_format_clause_opt(A) ::= json_format_clause(B). { A = B; } json_format_clause_opt(A) ::= . { A = (Node *) makeJsonFormat(JS_FORMAT_DEFAULT, JS_ENC_DEFAULT, -1); } /* ----- json_quotes_clause_opt ----- */ json_quotes_clause_opt(A) ::= KEEP QUOTES ON SCALAR STRING_P. { A = JS_QUOTES_KEEP; } json_quotes_clause_opt(A) ::= KEEP QUOTES. { A = JS_QUOTES_KEEP; } json_quotes_clause_opt(A) ::= OMIT QUOTES ON SCALAR STRING_P. { A = JS_QUOTES_OMIT; } json_quotes_clause_opt(A) ::= OMIT QUOTES. { A = JS_QUOTES_OMIT; } json_quotes_clause_opt(A) ::= . { A = JS_QUOTES_UNSPEC; } /* ----- json_returning_clause_opt ----- */ json_returning_clause_opt(A) ::= RETURNING typename(C) json_format_clause_opt(D). { JsonOutput *n = makeNode(JsonOutput); n->typeName = C; n->returning = makeNode(JsonReturning); n->returning->format = (JsonFormat *) D; A = (Node *) n; } json_returning_clause_opt(A) ::= . { A = NULL; } /* ----- json_predicate_type_constraint ----- */ json_predicate_type_constraint(A) ::= JSON. [UNBOUNDED] { A = JS_TYPE_ANY; } json_predicate_type_constraint(A) ::= JSON VALUE_P. { A = JS_TYPE_ANY; } json_predicate_type_constraint(A) ::= JSON ARRAY. { A = JS_TYPE_ARRAY; } json_predicate_type_constraint(A) ::= JSON OBJECT_P. { A = JS_TYPE_OBJECT; } json_predicate_type_constraint(A) ::= JSON SCALAR. { A = JS_TYPE_SCALAR; } /* ----- json_key_uniqueness_constraint_opt ----- */ json_key_uniqueness_constraint_opt(A) ::= WITH UNIQUE KEYS. { A = true; } json_key_uniqueness_constraint_opt(A) ::= WITH UNIQUE. [UNBOUNDED] { A = true; } json_key_uniqueness_constraint_opt(A) ::= WITHOUT UNIQUE KEYS. { A = false; } json_key_uniqueness_constraint_opt(A) ::= WITHOUT UNIQUE. [UNBOUNDED] { A = false; } json_key_uniqueness_constraint_opt(A) ::= . [UNBOUNDED] { A = false; } /* ----- json_name_and_value_list ----- */ json_name_and_value_list(A) ::= json_name_and_value(B). { A = list_make1(B); } json_name_and_value_list(A) ::= json_name_and_value_list(B) COMMA json_name_and_value(D). { A = lappend(B, D); } /* ----- json_name_and_value ----- */ json_name_and_value(A) ::= c_expr(B) VALUE_P json_value_expr(D). { A = makeJsonKeyValue(B, D); } json_name_and_value(A) ::= a_expr(B) COLON json_value_expr(D). { A = makeJsonKeyValue(B, D); } /* ----- json_object_constructor_null_clause_opt ----- */ json_object_constructor_null_clause_opt(A) ::= NULL_P ON NULL_P. { A = false; } json_object_constructor_null_clause_opt(A) ::= ABSENT ON NULL_P. { A = true; } json_object_constructor_null_clause_opt(A) ::= . { A = false; } /* ----- json_array_constructor_null_clause_opt ----- */ json_array_constructor_null_clause_opt(A) ::= NULL_P ON NULL_P. { A = false; } json_array_constructor_null_clause_opt(A) ::= ABSENT ON NULL_P. { A = true; } json_array_constructor_null_clause_opt(A) ::= . { A = true; } /* ----- json_value_expr_list ----- */ json_value_expr_list(A) ::= json_value_expr(B). { A = list_make1(B); } json_value_expr_list(A) ::= json_value_expr_list(B) COMMA json_value_expr(D). { A = lappend(B, D); } /* ----- json_aggregate_func ----- */ json_aggregate_func(A) ::= JSON_OBJECTAGG LPAREN json_name_and_value(D) json_object_constructor_null_clause_opt(E) json_key_uniqueness_constraint_opt(F) json_returning_clause_opt(G) RPAREN. { JsonObjectAgg *n = makeNode(JsonObjectAgg); n->arg = (JsonKeyValue *) D; n->absent_on_null = E; n->unique = F; n->constructor = makeNode(JsonAggConstructor); n->constructor->output = (JsonOutput *) G; n->constructor->agg_order = NULL; n->constructor->location = LOC(B); A = (Node *) n; } json_aggregate_func(A) ::= JSON_ARRAYAGG LPAREN json_value_expr(D) json_array_aggregate_order_by_clause_opt(E) json_array_constructor_null_clause_opt(F) json_returning_clause_opt(G) RPAREN. { JsonArrayAgg *n = makeNode(JsonArrayAgg); n->arg = (JsonValueExpr *) D; n->absent_on_null = F; n->constructor = makeNode(JsonAggConstructor); n->constructor->agg_order = E; n->constructor->output = (JsonOutput *) G; n->constructor->location = LOC(B); A = (Node *) n; } /* ----- json_array_aggregate_order_by_clause_opt ----- */ json_array_aggregate_order_by_clause_opt(A) ::= ORDER BY sortby_list(D). { A = D; } json_array_aggregate_order_by_clause_opt(A) ::= . { A = NIL; } /* ----- graph_pattern ----- */ graph_pattern(A) ::= path_pattern_list(B) where_clause(C). { GraphPattern *gp = makeNode(GraphPattern); gp->path_pattern_list = B; gp->whereClause = C; A = (Node *) gp; } /* ----- path_pattern_list ----- */ path_pattern_list(A) ::= path_pattern(B). { A = list_make1(B); } path_pattern_list(A) ::= path_pattern_list(B) COMMA path_pattern(D). { A = lappend(B, D); } /* ----- path_pattern ----- */ path_pattern(A) ::= path_pattern_expression(B). { A = B; } /* ----- path_pattern_expression ----- */ path_pattern_expression(A) ::= path_term(B). { A = B; } /* ----- path_term ----- */ path_term(A) ::= path_factor(B). { A = list_make1(B); } path_term(A) ::= path_term(B) path_factor(C). { A = lappend(B, C); } /* ----- path_factor ----- */ path_factor(A) ::= path_primary(B) opt_graph_pattern_quantifier(C). { GraphElementPattern *gep = (GraphElementPattern *) B; gep->quantifier = C; A = (Node *) gep; } /* ----- path_primary ----- */ path_primary(A) ::= LPAREN opt_colid(C) opt_is_label_expression(D) where_clause(E) RPAREN. { GraphElementPattern *gep = makeNode(GraphElementPattern); gep->kind = VERTEX_PATTERN; gep->variable = C; gep->labelexpr = D; gep->whereClause = E; gep->location = LOC(B); A = (Node *) gep; } path_primary(A) ::= LT MINUS LBRACKET opt_colid(E) opt_is_label_expression(F) where_clause(G) RBRACKET MINUS. { GraphElementPattern *gep = makeNode(GraphElementPattern); gep->kind = EDGE_PATTERN_LEFT; gep->variable = E; gep->labelexpr = F; gep->whereClause = G; gep->location = LOC(B); A = (Node *) gep; } path_primary(A) ::= MINUS LBRACKET opt_colid(D) opt_is_label_expression(E) where_clause(F) RBRACKET MINUS GT. { GraphElementPattern *gep = makeNode(GraphElementPattern); gep->kind = EDGE_PATTERN_RIGHT; gep->variable = D; gep->labelexpr = E; gep->whereClause = F; gep->location = LOC(B); A = (Node *) gep; } path_primary(A) ::= MINUS LBRACKET opt_colid(D) opt_is_label_expression(E) where_clause(F) RBRACKET RIGHT_ARROW. { GraphElementPattern *gep = makeNode(GraphElementPattern); gep->kind = EDGE_PATTERN_RIGHT; gep->variable = D; gep->labelexpr = E; gep->whereClause = F; gep->location = LOC(B); A = (Node *) gep; } path_primary(A) ::= MINUS LBRACKET opt_colid(D) opt_is_label_expression(E) where_clause(F) RBRACKET MINUS. { GraphElementPattern *gep = makeNode(GraphElementPattern); gep->kind = EDGE_PATTERN_ANY; gep->variable = D; gep->labelexpr = E; gep->whereClause = F; gep->location = LOC(B); A = (Node *) gep; } path_primary(A) ::= LT MINUS. { GraphElementPattern *gep = makeNode(GraphElementPattern); gep->kind = EDGE_PATTERN_LEFT; gep->location = LOC(B); A = (Node *) gep; } path_primary(A) ::= MINUS GT. { GraphElementPattern *gep = makeNode(GraphElementPattern); gep->kind = EDGE_PATTERN_RIGHT; gep->location = LOC(B); A = (Node *) gep; } path_primary(A) ::= RIGHT_ARROW. { GraphElementPattern *gep = makeNode(GraphElementPattern); gep->kind = EDGE_PATTERN_RIGHT; gep->location = LOC(B); A = (Node *) gep; } path_primary(A) ::= MINUS. { GraphElementPattern *gep = makeNode(GraphElementPattern); gep->kind = EDGE_PATTERN_ANY; gep->location = LOC(B); A = (Node *) gep; } path_primary(A) ::= LPAREN path_pattern_expression(C) where_clause(D) RPAREN. { GraphElementPattern *gep = makeNode(GraphElementPattern); gep->kind = PAREN_EXPR; gep->subexpr = C; gep->whereClause = D; gep->location = LOC(B); A = (Node *) gep; } /* ----- opt_colid ----- */ opt_colid(A) ::= colId(B). { A = B; } opt_colid(A) ::= . { A = NULL; } /* ----- opt_is_label_expression ----- */ opt_is_label_expression(A) ::= IS label_expression(C). { A = C; } opt_is_label_expression(A) ::= . { A = NULL; } /* ----- opt_graph_pattern_quantifier ----- */ opt_graph_pattern_quantifier(A) ::= LBRACE iconst(C) RBRACE. { A = list_make2_int(C, C); } opt_graph_pattern_quantifier(A) ::= LBRACE COMMA iconst(D) RBRACE. { A = list_make2_int(0, D); } opt_graph_pattern_quantifier(A) ::= LBRACE iconst(C) COMMA iconst(E) RBRACE. { A = list_make2_int(C, E); } opt_graph_pattern_quantifier(A) ::= . { A = NULL; } /* ----- label_expression ----- */ label_expression(A) ::= label_term(B). label_expression(A) ::= label_disjunction(B). /* ----- label_disjunction ----- */ label_disjunction(A) ::= label_expression(B) PIPE label_term(D). { A = makeOrExpr(B, D, LOC(C)); } /* ----- label_term ----- */ label_term(A) ::= name(B). { A = makeColumnRef(B, NIL, LOC(B), yyscanner); } /* ----- opt_target_list ----- */ opt_target_list(A) ::= target_list(B). { A = B; } opt_target_list(A) ::= . { A = NIL; } /* ----- target_list ----- */ target_list(A) ::= target_el(B). { A = list_make1(B); } target_list(A) ::= target_list(B) COMMA target_el(D). { A = lappend(B, D); } /* ----- target_el ----- */ target_el(A) ::= a_expr(B) AS colLabel(D). { A = makeNode(ResTarget); A->name = D; A->indirection = NIL; A->val = (Node *) B; A->location = LOC(B); } target_el(A) ::= a_expr(B) bareColLabel(C). { A = makeNode(ResTarget); A->name = C; A->indirection = NIL; A->val = (Node *) B; A->location = LOC(B); } target_el(A) ::= a_expr(B). { A = makeNode(ResTarget); A->name = NULL; A->indirection = NIL; A->val = (Node *) B; A->location = LOC(B); } target_el(A) ::= STAR. { ColumnRef *n = makeNode(ColumnRef); n->fields = list_make1(makeNode(A_Star)); n->location = LOC(B); A = makeNode(ResTarget); A->name = NULL; A->indirection = NIL; A->val = (Node *) n; A->location = LOC(B); } /* ----- qualified_name_list ----- */ qualified_name_list(A) ::= qualified_name(B). { A = list_make1(B); } qualified_name_list(A) ::= qualified_name_list(B) COMMA qualified_name(D). { A = lappend(B, D); } /* ----- qualified_name ----- */ qualified_name(A) ::= colId(B). { A = makeRangeVar(NULL, B, LOC(B)); } qualified_name(A) ::= colId(B) indirection(C). { A = makeRangeVarFromQualifiedName(B, C, LOC(B), yyscanner); } /* ----- name_list ----- */ name_list(A) ::= name(B). { A = list_make1(makeString(B)); } name_list(A) ::= name_list(B) COMMA name(D). { A = lappend(B, makeString(D)); } /* ----- name ----- */ name(A) ::= colId(B). { A = B; } /* ----- attr_name ----- */ attr_name(A) ::= colLabel(B). { A = B; } /* ----- file_name ----- */ file_name(A) ::= sconst(B). { A = B; } /* ----- func_name ----- */ func_name(A) ::= type_function_name(B). { A = list_make1(makeString(B)); } func_name(A) ::= colId(B) indirection(C). { A = check_func_name(lcons(makeString(B), C), yyscanner); } /* ----- aexprConst ----- */ aexprConst(A) ::= iconst(B). { A = makeIntConst(B, LOC(B)); } aexprConst(A) ::= FCONST. { A = makeFloatConst(B, LOC(B)); } aexprConst(A) ::= sconst(B). { A = makeStringConst(B, LOC(B)); } aexprConst(A) ::= BCONST. { A = makeBitStringConst(B, LOC(B)); } aexprConst(A) ::= XCONST. { A = makeBitStringConst(B, LOC(B)); } aexprConst(A) ::= func_name(B) sconst(C). { TypeName *t = makeTypeNameFromNameList(B); t->location = LOC(B); A = makeStringConstCast(C, LOC(C), t); } aexprConst(A) ::= func_name(B) LPAREN func_arg_list(D) opt_sort_clause(E) RPAREN sconst(G). { TypeName *t = makeTypeNameFromNameList(B); ListCell *lc; foreach(lc, D) { NamedArgExpr *arg = (NamedArgExpr *) lfirst(lc); if (IsA(arg, NamedArgExpr)) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("type modifier cannot have parameter name"), parser_errposition(arg->location))); } if (E != NIL) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("type modifier cannot have ORDER BY"), parser_errposition(LOC(E)))); t->typmods = D; t->location = LOC(B); A = makeStringConstCast(G, LOC(G), t); } aexprConst(A) ::= constTypename(B) sconst(C). { A = makeStringConstCast(C, LOC(C), B); } aexprConst(A) ::= constInterval(B) sconst(C) opt_interval(D). { TypeName *t = B; t->typmods = D; A = makeStringConstCast(C, LOC(C), t); } aexprConst(A) ::= constInterval(B) LPAREN iconst(D) RPAREN sconst(F). { TypeName *t = B; t->typmods = list_make2(makeIntConst(INTERVAL_FULL_RANGE, -1), makeIntConst(D, LOC(D))); A = makeStringConstCast(F, LOC(F), t); } aexprConst(A) ::= TRUE_P. { A = makeBoolAConst(true, LOC(B)); } aexprConst(A) ::= FALSE_P. { A = makeBoolAConst(false, LOC(B)); } aexprConst(A) ::= NULL_P. { A = makeNullAConst(LOC(B)); } /* ----- iconst ----- */ iconst(A) ::= ICONST. { A = B; } /* ----- sconst ----- */ sconst(A) ::= SCONST. { A = B; } /* ----- signedIconst ----- */ signedIconst(A) ::= iconst(B). { A = B; } signedIconst(A) ::= PLUS iconst(C). { A = + C; } signedIconst(A) ::= MINUS iconst(C). { A = - C; } /* ----- roleId ----- */ roleId(A) ::= roleSpec(B). { roleSpec *spc = (roleSpec *) B; switch (spc->roletype) { case ROLESPEC_CSTRING: A = spc->rolename; break; case ROLESPEC_PUBLIC: ereport(ERROR, (errcode(ERRCODE_RESERVED_NAME), errmsg("role name \"%s\" is reserved", "public"), parser_errposition(LOC(B)))); break; case ROLESPEC_SESSION_USER: ereport(ERROR, (errcode(ERRCODE_RESERVED_NAME), errmsg("%s cannot be used as a role name here", "SESSION_USER"), parser_errposition(LOC(B)))); break; case ROLESPEC_CURRENT_USER: ereport(ERROR, (errcode(ERRCODE_RESERVED_NAME), errmsg("%s cannot be used as a role name here", "CURRENT_USER"), parser_errposition(LOC(B)))); break; case ROLESPEC_CURRENT_ROLE: ereport(ERROR, (errcode(ERRCODE_RESERVED_NAME), errmsg("%s cannot be used as a role name here", "CURRENT_ROLE"), parser_errposition(LOC(B)))); break; } } /* ----- roleSpec ----- */ roleSpec(A) ::= nonReservedWord(B). { roleSpec *n; if (strcmp(B, "public") == 0) { n = (roleSpec *) makeRoleSpec(ROLESPEC_PUBLIC, LOC(B)); n->roletype = ROLESPEC_PUBLIC; } else if (strcmp(B, "none") == 0) { ereport(ERROR, (errcode(ERRCODE_RESERVED_NAME), errmsg("role name \"%s\" is reserved", "none"), parser_errposition(LOC(B)))); } else { n = makeRoleSpec(ROLESPEC_CSTRING, LOC(B)); n->rolename = pstrdup(B); } A = n; } roleSpec(A) ::= CURRENT_ROLE. { A = makeRoleSpec(ROLESPEC_CURRENT_ROLE, LOC(B)); } roleSpec(A) ::= CURRENT_USER. { A = makeRoleSpec(ROLESPEC_CURRENT_USER, LOC(B)); } roleSpec(A) ::= SESSION_USER. { A = makeRoleSpec(ROLESPEC_SESSION_USER, LOC(B)); } /* ----- role_list ----- */ role_list(A) ::= roleSpec(B). { A = list_make1(B); } role_list(A) ::= role_list(B) COMMA roleSpec(D). { A = lappend(B, D); } /* ----- pLpgSQL_Expr ----- */ pLpgSQL_Expr(A) ::= opt_distinct_clause(B) opt_target_list(C) from_clause(D) where_clause(E) group_clause(F) having_clause(G) window_clause(H) opt_sort_clause(I) opt_select_limit(J) opt_for_locking_clause(K). { selectStmt *n = makeNode(selectStmt); n->distinctClause = B; n->targetList = C; n->fromClause = D; n->whereClause = E; n->groupClause = (F)->list; n->groupDistinct = (F)->distinct; n->groupByAll = (F)->all; n->havingClause = G; n->windowClause = H; n->sortClause = I; if (J) { n->limitOffset = J->limitOffset; n->limitCount = J->limitCount; if (!n->sortClause && J->limitOption == LIMIT_OPTION_WITH_TIES) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("WITH TIES cannot be specified without ORDER BY clause"), parser_errposition(J->optionLoc))); n->limitOption = J->limitOption; } n->lockingClause = K; A = (Node *) n; } /* ----- pLAssignStmt ----- */ pLAssignStmt(A) ::= plassign_target(B) opt_indirection(C) plassign_equals(D) pLpgSQL_Expr(E). { pLAssignStmt *n = makeNode(pLAssignStmt); n->name = B; n->indirection = check_indirection(C, yyscanner); n->val = (selectStmt *) E; n->location = LOC(B); A = (Node *) n; } /* ----- plassign_target ----- */ plassign_target(A) ::= colId(B). { A = B; } plassign_target(A) ::= PARAM. { A = psprintf("$%d", B); } /* ----- plassign_equals ----- */ plassign_equals(A) ::= COLON_EQUALS. plassign_equals(A) ::= EQ. /* ----- colId ----- */ colId(A) ::= IDENT. { A = B; } colId(A) ::= unreserved_keyword(B). { A = pstrdup(B); } colId(A) ::= col_name_keyword(B). { A = pstrdup(B); } /* ----- type_function_name ----- */ type_function_name(A) ::= IDENT. { A = B; } type_function_name(A) ::= unreserved_keyword(B). { A = pstrdup(B); } type_function_name(A) ::= type_func_name_keyword(B). { A = pstrdup(B); } /* ----- nonReservedWord ----- */ nonReservedWord(A) ::= IDENT. { A = B; } nonReservedWord(A) ::= unreserved_keyword(B). { A = pstrdup(B); } nonReservedWord(A) ::= col_name_keyword(B). { A = pstrdup(B); } nonReservedWord(A) ::= type_func_name_keyword(B). { A = pstrdup(B); } /* ----- colLabel ----- */ colLabel(A) ::= IDENT. { A = B; } colLabel(A) ::= unreserved_keyword(B). { A = pstrdup(B); } colLabel(A) ::= col_name_keyword(B). { A = pstrdup(B); } colLabel(A) ::= type_func_name_keyword(B). { A = pstrdup(B); } colLabel(A) ::= reserved_keyword(B). { A = pstrdup(B); } /* ----- bareColLabel ----- */ bareColLabel(A) ::= IDENT. { A = B; } bareColLabel(A) ::= bare_label_keyword(B). { A = pstrdup(B); } /* ----- unreserved_keyword ----- */ unreserved_keyword(A) ::= ABORT_P. unreserved_keyword(A) ::= ABSENT. unreserved_keyword(A) ::= ABSOLUTE_P. unreserved_keyword(A) ::= ACCESS. unreserved_keyword(A) ::= ACTION. unreserved_keyword(A) ::= ADD_P. unreserved_keyword(A) ::= ADMIN. unreserved_keyword(A) ::= AFTER. unreserved_keyword(A) ::= AGGREGATE. unreserved_keyword(A) ::= ALSO. unreserved_keyword(A) ::= ALTER. unreserved_keyword(A) ::= ALWAYS. unreserved_keyword(A) ::= ASENSITIVE. unreserved_keyword(A) ::= ASSERTION. unreserved_keyword(A) ::= ASSIGNMENT. unreserved_keyword(A) ::= AT. unreserved_keyword(A) ::= ATOMIC. unreserved_keyword(A) ::= ATTACH. unreserved_keyword(A) ::= ATTRIBUTE. unreserved_keyword(A) ::= BACKWARD. unreserved_keyword(A) ::= BEFORE. unreserved_keyword(A) ::= BEGIN_P. unreserved_keyword(A) ::= BREADTH. unreserved_keyword(A) ::= BY. unreserved_keyword(A) ::= CACHE. unreserved_keyword(A) ::= CALL. unreserved_keyword(A) ::= CALLED. unreserved_keyword(A) ::= CASCADE. unreserved_keyword(A) ::= CASCADED. unreserved_keyword(A) ::= CATALOG_P. unreserved_keyword(A) ::= CHAIN. unreserved_keyword(A) ::= CHARACTERISTICS. unreserved_keyword(A) ::= CHECKPOINT. unreserved_keyword(A) ::= CLASS. unreserved_keyword(A) ::= CLOSE. unreserved_keyword(A) ::= CLUSTER. unreserved_keyword(A) ::= COLUMNS. unreserved_keyword(A) ::= COMMENT. unreserved_keyword(A) ::= COMMENTS. unreserved_keyword(A) ::= COMMIT. unreserved_keyword(A) ::= COMMITTED. unreserved_keyword(A) ::= COMPRESSION. unreserved_keyword(A) ::= CONDITIONAL. unreserved_keyword(A) ::= CONFIGURATION. unreserved_keyword(A) ::= CONFLICT. unreserved_keyword(A) ::= CONNECTION. unreserved_keyword(A) ::= CONSTRAINTS. unreserved_keyword(A) ::= CONTENT_P. unreserved_keyword(A) ::= CONTINUE_P. unreserved_keyword(A) ::= CONVERSION_P. unreserved_keyword(A) ::= COPY. unreserved_keyword(A) ::= COST. unreserved_keyword(A) ::= CSV. unreserved_keyword(A) ::= CUBE. unreserved_keyword(A) ::= CURRENT_P. unreserved_keyword(A) ::= CURSOR. unreserved_keyword(A) ::= CYCLE. unreserved_keyword(A) ::= DATA_P. unreserved_keyword(A) ::= DATABASE. unreserved_keyword(A) ::= DAY_P. unreserved_keyword(A) ::= DEALLOCATE. unreserved_keyword(A) ::= DECLARE. unreserved_keyword(A) ::= DEFAULTS. unreserved_keyword(A) ::= DEFERRED. unreserved_keyword(A) ::= DEFINER. unreserved_keyword(A) ::= DELETE_P. unreserved_keyword(A) ::= DELIMITER. unreserved_keyword(A) ::= DELIMITERS. unreserved_keyword(A) ::= DEPENDS. unreserved_keyword(A) ::= DEPTH. unreserved_keyword(A) ::= DESTINATION. unreserved_keyword(A) ::= DETACH. unreserved_keyword(A) ::= DICTIONARY. unreserved_keyword(A) ::= DISABLE_P. unreserved_keyword(A) ::= DISCARD. unreserved_keyword(A) ::= DOCUMENT_P. unreserved_keyword(A) ::= DOMAIN_P. unreserved_keyword(A) ::= DOUBLE_P. unreserved_keyword(A) ::= DROP. unreserved_keyword(A) ::= EACH. unreserved_keyword(A) ::= EDGE. unreserved_keyword(A) ::= EMPTY_P. unreserved_keyword(A) ::= ENABLE_P. unreserved_keyword(A) ::= ENCODING. unreserved_keyword(A) ::= ENCRYPTED. unreserved_keyword(A) ::= ENFORCED. unreserved_keyword(A) ::= ENUM_P. unreserved_keyword(A) ::= ERROR_P. unreserved_keyword(A) ::= ESCAPE. unreserved_keyword(A) ::= EVENT. unreserved_keyword(A) ::= EXCLUDE. unreserved_keyword(A) ::= EXCLUDING. unreserved_keyword(A) ::= EXCLUSIVE. unreserved_keyword(A) ::= EXECUTE. unreserved_keyword(A) ::= EXPLAIN. unreserved_keyword(A) ::= EXPRESSION. unreserved_keyword(A) ::= EXTENSION. unreserved_keyword(A) ::= EXTERNAL. unreserved_keyword(A) ::= FAMILY. unreserved_keyword(A) ::= FILTER. unreserved_keyword(A) ::= FINALIZE. unreserved_keyword(A) ::= FIRST_P. unreserved_keyword(A) ::= FOLLOWING. unreserved_keyword(A) ::= FORCE. unreserved_keyword(A) ::= FORMAT. unreserved_keyword(A) ::= FORWARD. unreserved_keyword(A) ::= FUNCTION. unreserved_keyword(A) ::= FUNCTIONS. unreserved_keyword(A) ::= GENERATED. unreserved_keyword(A) ::= GLOBAL. unreserved_keyword(A) ::= GRANTED. unreserved_keyword(A) ::= GRAPH. unreserved_keyword(A) ::= GROUPS. unreserved_keyword(A) ::= HANDLER. unreserved_keyword(A) ::= HEADER_P. unreserved_keyword(A) ::= HOLD. unreserved_keyword(A) ::= HOUR_P. unreserved_keyword(A) ::= IDENTITY_P. unreserved_keyword(A) ::= IF_P. unreserved_keyword(A) ::= IGNORE_P. unreserved_keyword(A) ::= IMMEDIATE. unreserved_keyword(A) ::= IMMUTABLE. unreserved_keyword(A) ::= IMPLICIT_P. unreserved_keyword(A) ::= IMPORT_P. unreserved_keyword(A) ::= INCLUDE. unreserved_keyword(A) ::= INCLUDING. unreserved_keyword(A) ::= INCREMENT. unreserved_keyword(A) ::= INDENT. unreserved_keyword(A) ::= INDEX. unreserved_keyword(A) ::= INDEXES. unreserved_keyword(A) ::= INHERIT. unreserved_keyword(A) ::= INHERITS. unreserved_keyword(A) ::= INLINE_P. unreserved_keyword(A) ::= INPUT_P. unreserved_keyword(A) ::= INSENSITIVE. unreserved_keyword(A) ::= INSERT. unreserved_keyword(A) ::= INSTEAD. unreserved_keyword(A) ::= INVOKER. unreserved_keyword(A) ::= ISOLATION. unreserved_keyword(A) ::= KEEP. unreserved_keyword(A) ::= KEY. unreserved_keyword(A) ::= KEYS. unreserved_keyword(A) ::= LABEL. unreserved_keyword(A) ::= LANGUAGE. unreserved_keyword(A) ::= LARGE_P. unreserved_keyword(A) ::= LAST_P. unreserved_keyword(A) ::= LEAKPROOF. unreserved_keyword(A) ::= LEVEL. unreserved_keyword(A) ::= LISTEN. unreserved_keyword(A) ::= LOAD. unreserved_keyword(A) ::= LOCAL. unreserved_keyword(A) ::= LOCATION. unreserved_keyword(A) ::= LOCK_P. unreserved_keyword(A) ::= LOCKED. unreserved_keyword(A) ::= LOGGED. unreserved_keyword(A) ::= LSN_P. unreserved_keyword(A) ::= MAPPING. unreserved_keyword(A) ::= MATCH. unreserved_keyword(A) ::= MATCHED. unreserved_keyword(A) ::= MATERIALIZED. unreserved_keyword(A) ::= MAXVALUE. unreserved_keyword(A) ::= MERGE. unreserved_keyword(A) ::= METHOD. unreserved_keyword(A) ::= MINUTE_P. unreserved_keyword(A) ::= MINVALUE. unreserved_keyword(A) ::= MODE. unreserved_keyword(A) ::= MONTH_P. unreserved_keyword(A) ::= MOVE. unreserved_keyword(A) ::= NAME_P. unreserved_keyword(A) ::= NAMES. unreserved_keyword(A) ::= NESTED. unreserved_keyword(A) ::= NEW. unreserved_keyword(A) ::= NEXT. unreserved_keyword(A) ::= NFC. unreserved_keyword(A) ::= NFD. unreserved_keyword(A) ::= NFKC. unreserved_keyword(A) ::= NFKD. unreserved_keyword(A) ::= NO. unreserved_keyword(A) ::= NODE. unreserved_keyword(A) ::= NORMALIZED. unreserved_keyword(A) ::= NOTHING. unreserved_keyword(A) ::= NOTIFY. unreserved_keyword(A) ::= NOWAIT. unreserved_keyword(A) ::= NULLS_P. unreserved_keyword(A) ::= OBJECT_P. unreserved_keyword(A) ::= OBJECTS_P. unreserved_keyword(A) ::= OF. unreserved_keyword(A) ::= OFF. unreserved_keyword(A) ::= OIDS. unreserved_keyword(A) ::= OLD. unreserved_keyword(A) ::= OMIT. unreserved_keyword(A) ::= OPERATOR. unreserved_keyword(A) ::= OPTION. unreserved_keyword(A) ::= OPTIONS. unreserved_keyword(A) ::= ORDINALITY. unreserved_keyword(A) ::= OTHERS. unreserved_keyword(A) ::= OVER. unreserved_keyword(A) ::= OVERRIDING. unreserved_keyword(A) ::= OWNED. unreserved_keyword(A) ::= OWNER. unreserved_keyword(A) ::= PARALLEL. unreserved_keyword(A) ::= PARAMETER. unreserved_keyword(A) ::= PARSER. unreserved_keyword(A) ::= PARTIAL. unreserved_keyword(A) ::= PARTITION. unreserved_keyword(A) ::= PARTITIONS. unreserved_keyword(A) ::= PASSING. unreserved_keyword(A) ::= PASSWORD. unreserved_keyword(A) ::= PATH. unreserved_keyword(A) ::= PERIOD. unreserved_keyword(A) ::= PLAN. unreserved_keyword(A) ::= PLANS. unreserved_keyword(A) ::= POLICY. unreserved_keyword(A) ::= PRECEDING. unreserved_keyword(A) ::= PREPARE. unreserved_keyword(A) ::= PREPARED. unreserved_keyword(A) ::= PRESERVE. unreserved_keyword(A) ::= PRIOR. unreserved_keyword(A) ::= PRIVILEGES. unreserved_keyword(A) ::= PROCEDURAL. unreserved_keyword(A) ::= PROCEDURE. unreserved_keyword(A) ::= PROCEDURES. unreserved_keyword(A) ::= PROGRAM. unreserved_keyword(A) ::= PROPERTIES. unreserved_keyword(A) ::= PROPERTY. unreserved_keyword(A) ::= PUBLICATION. unreserved_keyword(A) ::= QUOTE. unreserved_keyword(A) ::= QUOTES. unreserved_keyword(A) ::= RANGE. unreserved_keyword(A) ::= READ. unreserved_keyword(A) ::= REASSIGN. unreserved_keyword(A) ::= RECURSIVE. unreserved_keyword(A) ::= REF_P. unreserved_keyword(A) ::= REFERENCING. unreserved_keyword(A) ::= REFRESH. unreserved_keyword(A) ::= REINDEX. unreserved_keyword(A) ::= RELATIONSHIP. unreserved_keyword(A) ::= RELATIVE_P. unreserved_keyword(A) ::= RELEASE. unreserved_keyword(A) ::= RENAME. unreserved_keyword(A) ::= REPACK. unreserved_keyword(A) ::= REPEATABLE. unreserved_keyword(A) ::= REPLACE. unreserved_keyword(A) ::= REPLICA. unreserved_keyword(A) ::= RESET. unreserved_keyword(A) ::= RESPECT_P. unreserved_keyword(A) ::= RESTART. unreserved_keyword(A) ::= RESTRICT. unreserved_keyword(A) ::= RETURN. unreserved_keyword(A) ::= RETURNS. unreserved_keyword(A) ::= REVOKE. unreserved_keyword(A) ::= ROLE. unreserved_keyword(A) ::= ROLLBACK. unreserved_keyword(A) ::= ROLLUP. unreserved_keyword(A) ::= ROUTINE. unreserved_keyword(A) ::= ROUTINES. unreserved_keyword(A) ::= ROWS. unreserved_keyword(A) ::= RULE. unreserved_keyword(A) ::= SAVEPOINT. unreserved_keyword(A) ::= SCALAR. unreserved_keyword(A) ::= SCHEMA. unreserved_keyword(A) ::= SCHEMAS. unreserved_keyword(A) ::= SCROLL. unreserved_keyword(A) ::= SEARCH. unreserved_keyword(A) ::= SECOND_P. unreserved_keyword(A) ::= SECURITY. unreserved_keyword(A) ::= SEQUENCE. unreserved_keyword(A) ::= SEQUENCES. unreserved_keyword(A) ::= SERIALIZABLE. unreserved_keyword(A) ::= SERVER. unreserved_keyword(A) ::= SESSION. unreserved_keyword(A) ::= SET. unreserved_keyword(A) ::= SETS. unreserved_keyword(A) ::= SHARE. unreserved_keyword(A) ::= SHOW. unreserved_keyword(A) ::= SIMPLE. unreserved_keyword(A) ::= SKIP. unreserved_keyword(A) ::= SNAPSHOT. unreserved_keyword(A) ::= SOURCE. unreserved_keyword(A) ::= SPLIT. unreserved_keyword(A) ::= SQL_P. unreserved_keyword(A) ::= STABLE. unreserved_keyword(A) ::= STANDALONE_P. unreserved_keyword(A) ::= START. unreserved_keyword(A) ::= STATEMENT. unreserved_keyword(A) ::= STATISTICS. unreserved_keyword(A) ::= STDIN. unreserved_keyword(A) ::= STDOUT. unreserved_keyword(A) ::= STORAGE. unreserved_keyword(A) ::= STORED. unreserved_keyword(A) ::= STRICT_P. unreserved_keyword(A) ::= STRING_P. unreserved_keyword(A) ::= STRIP_P. unreserved_keyword(A) ::= SUBSCRIPTION. unreserved_keyword(A) ::= SUPPORT. unreserved_keyword(A) ::= SYSID. unreserved_keyword(A) ::= SYSTEM_P. unreserved_keyword(A) ::= TABLES. unreserved_keyword(A) ::= TABLESPACE. unreserved_keyword(A) ::= TARGET. unreserved_keyword(A) ::= TEMP. unreserved_keyword(A) ::= TEMPLATE. unreserved_keyword(A) ::= TEMPORARY. unreserved_keyword(A) ::= TEXT_P. unreserved_keyword(A) ::= TIES. unreserved_keyword(A) ::= TRANSACTION. unreserved_keyword(A) ::= TRANSFORM. unreserved_keyword(A) ::= TRIGGER. unreserved_keyword(A) ::= TRUNCATE. unreserved_keyword(A) ::= TRUSTED. unreserved_keyword(A) ::= TYPE_P. unreserved_keyword(A) ::= TYPES_P. unreserved_keyword(A) ::= UESCAPE. unreserved_keyword(A) ::= UNBOUNDED. unreserved_keyword(A) ::= UNCOMMITTED. unreserved_keyword(A) ::= UNCONDITIONAL. unreserved_keyword(A) ::= UNENCRYPTED. unreserved_keyword(A) ::= UNKNOWN. unreserved_keyword(A) ::= UNLISTEN. unreserved_keyword(A) ::= UNLOGGED. unreserved_keyword(A) ::= UNTIL. unreserved_keyword(A) ::= UPDATE. unreserved_keyword(A) ::= VACUUM. unreserved_keyword(A) ::= VALID. unreserved_keyword(A) ::= VALIDATE. unreserved_keyword(A) ::= VALIDATOR. unreserved_keyword(A) ::= VALUE_P. unreserved_keyword(A) ::= VARYING. unreserved_keyword(A) ::= VERSION_P. unreserved_keyword(A) ::= VERTEX. unreserved_keyword(A) ::= VIEW. unreserved_keyword(A) ::= VIEWS. unreserved_keyword(A) ::= VIRTUAL. unreserved_keyword(A) ::= VOLATILE. unreserved_keyword(A) ::= WAIT. unreserved_keyword(A) ::= WHITESPACE_P. unreserved_keyword(A) ::= WITHIN. unreserved_keyword(A) ::= WITHOUT. unreserved_keyword(A) ::= WORK. unreserved_keyword(A) ::= WRAPPER. unreserved_keyword(A) ::= WRITE. unreserved_keyword(A) ::= XML_P. unreserved_keyword(A) ::= YEAR_P. unreserved_keyword(A) ::= YES_P. unreserved_keyword(A) ::= ZONE. /* ----- col_name_keyword ----- */ col_name_keyword(A) ::= BETWEEN. col_name_keyword(A) ::= BIGINT. col_name_keyword(A) ::= BIT. col_name_keyword(A) ::= BOOLEAN_P. col_name_keyword(A) ::= CHAR_P. col_name_keyword(A) ::= CHARACTER. col_name_keyword(A) ::= COALESCE. col_name_keyword(A) ::= DEC. col_name_keyword(A) ::= DECIMAL_P. col_name_keyword(A) ::= EXISTS. col_name_keyword(A) ::= EXTRACT. col_name_keyword(A) ::= FLOAT_P. col_name_keyword(A) ::= GRAPH_TABLE. col_name_keyword(A) ::= GREATEST. col_name_keyword(A) ::= GROUPING. col_name_keyword(A) ::= INOUT. col_name_keyword(A) ::= INT_P. col_name_keyword(A) ::= INTEGER. col_name_keyword(A) ::= INTERVAL. col_name_keyword(A) ::= JSON. col_name_keyword(A) ::= JSON_ARRAY. col_name_keyword(A) ::= JSON_ARRAYAGG. col_name_keyword(A) ::= JSON_EXISTS. col_name_keyword(A) ::= JSON_OBJECT. col_name_keyword(A) ::= JSON_OBJECTAGG. col_name_keyword(A) ::= JSON_QUERY. col_name_keyword(A) ::= JSON_SCALAR. col_name_keyword(A) ::= JSON_SERIALIZE. col_name_keyword(A) ::= JSON_TABLE. col_name_keyword(A) ::= JSON_VALUE. col_name_keyword(A) ::= LEAST. col_name_keyword(A) ::= MERGE_ACTION. col_name_keyword(A) ::= NATIONAL. col_name_keyword(A) ::= NCHAR. col_name_keyword(A) ::= NONE. col_name_keyword(A) ::= NORMALIZE. col_name_keyword(A) ::= NULLIF. col_name_keyword(A) ::= NUMERIC. col_name_keyword(A) ::= OUT_P. col_name_keyword(A) ::= OVERLAY. col_name_keyword(A) ::= POSITION. col_name_keyword(A) ::= PRECISION. col_name_keyword(A) ::= REAL. col_name_keyword(A) ::= ROW. col_name_keyword(A) ::= SETOF. col_name_keyword(A) ::= SMALLINT. col_name_keyword(A) ::= SUBSTRING. col_name_keyword(A) ::= TIME. col_name_keyword(A) ::= TIMESTAMP. col_name_keyword(A) ::= TREAT. col_name_keyword(A) ::= TRIM. col_name_keyword(A) ::= VALUES. col_name_keyword(A) ::= VARCHAR. col_name_keyword(A) ::= XMLATTRIBUTES. col_name_keyword(A) ::= XMLCONCAT. col_name_keyword(A) ::= XMLELEMENT. col_name_keyword(A) ::= XMLEXISTS. col_name_keyword(A) ::= XMLFOREST. col_name_keyword(A) ::= XMLNAMESPACES. col_name_keyword(A) ::= XMLPARSE. col_name_keyword(A) ::= XMLPI. col_name_keyword(A) ::= XMLROOT. col_name_keyword(A) ::= XMLSERIALIZE. col_name_keyword(A) ::= XMLTABLE. /* ----- type_func_name_keyword ----- */ type_func_name_keyword(A) ::= AUTHORIZATION. type_func_name_keyword(A) ::= BINARY. type_func_name_keyword(A) ::= COLLATION. type_func_name_keyword(A) ::= CONCURRENTLY. type_func_name_keyword(A) ::= CROSS. type_func_name_keyword(A) ::= CURRENT_SCHEMA. type_func_name_keyword(A) ::= FREEZE. type_func_name_keyword(A) ::= FULL. type_func_name_keyword(A) ::= ILIKE. type_func_name_keyword(A) ::= INNER_P. type_func_name_keyword(A) ::= IS. type_func_name_keyword(A) ::= ISNULL. type_func_name_keyword(A) ::= JOIN. type_func_name_keyword(A) ::= LEFT. type_func_name_keyword(A) ::= LIKE. type_func_name_keyword(A) ::= NATURAL. type_func_name_keyword(A) ::= NOTNULL. type_func_name_keyword(A) ::= OUTER_P. type_func_name_keyword(A) ::= OVERLAPS. type_func_name_keyword(A) ::= RIGHT. type_func_name_keyword(A) ::= SIMILAR. type_func_name_keyword(A) ::= TABLESAMPLE. type_func_name_keyword(A) ::= VERBOSE. /* ----- reserved_keyword ----- */ reserved_keyword(A) ::= ALL. reserved_keyword(A) ::= ANALYSE. reserved_keyword(A) ::= ANALYZE. reserved_keyword(A) ::= AND. reserved_keyword(A) ::= ANY. reserved_keyword(A) ::= ARRAY. reserved_keyword(A) ::= AS. reserved_keyword(A) ::= ASC. reserved_keyword(A) ::= ASYMMETRIC. reserved_keyword(A) ::= BOTH. reserved_keyword(A) ::= CASE. reserved_keyword(A) ::= CAST. reserved_keyword(A) ::= CHECK. reserved_keyword(A) ::= COLLATE. reserved_keyword(A) ::= COLUMN. reserved_keyword(A) ::= CONSTRAINT. reserved_keyword(A) ::= CREATE. reserved_keyword(A) ::= CURRENT_CATALOG. reserved_keyword(A) ::= CURRENT_DATE. reserved_keyword(A) ::= CURRENT_ROLE. reserved_keyword(A) ::= CURRENT_TIME. reserved_keyword(A) ::= CURRENT_TIMESTAMP. reserved_keyword(A) ::= CURRENT_USER. reserved_keyword(A) ::= DEFAULT. reserved_keyword(A) ::= DEFERRABLE. reserved_keyword(A) ::= DESC. reserved_keyword(A) ::= DISTINCT. reserved_keyword(A) ::= DO. reserved_keyword(A) ::= ELSE. reserved_keyword(A) ::= END_P. reserved_keyword(A) ::= EXCEPT. reserved_keyword(A) ::= FALSE_P. reserved_keyword(A) ::= FETCH. reserved_keyword(A) ::= FOR. reserved_keyword(A) ::= FOREIGN. reserved_keyword(A) ::= FROM. reserved_keyword(A) ::= GRANT. reserved_keyword(A) ::= GROUP_P. reserved_keyword(A) ::= HAVING. reserved_keyword(A) ::= IN_P. reserved_keyword(A) ::= INITIALLY. reserved_keyword(A) ::= INTERSECT. reserved_keyword(A) ::= INTO. reserved_keyword(A) ::= LATERAL_P. reserved_keyword(A) ::= LEADING. reserved_keyword(A) ::= LIMIT. reserved_keyword(A) ::= LOCALTIME. reserved_keyword(A) ::= LOCALTIMESTAMP. reserved_keyword(A) ::= NOT. reserved_keyword(A) ::= NULL_P. reserved_keyword(A) ::= OFFSET. reserved_keyword(A) ::= ON. reserved_keyword(A) ::= ONLY. reserved_keyword(A) ::= OR. reserved_keyword(A) ::= ORDER. reserved_keyword(A) ::= PLACING. reserved_keyword(A) ::= PRIMARY. reserved_keyword(A) ::= REFERENCES. reserved_keyword(A) ::= RETURNING. reserved_keyword(A) ::= SELECT. reserved_keyword(A) ::= SESSION_USER. reserved_keyword(A) ::= SOME. reserved_keyword(A) ::= SYMMETRIC. reserved_keyword(A) ::= SYSTEM_USER. reserved_keyword(A) ::= TABLE. reserved_keyword(A) ::= THEN. reserved_keyword(A) ::= TO. reserved_keyword(A) ::= TRAILING. reserved_keyword(A) ::= TRUE_P. reserved_keyword(A) ::= UNION. reserved_keyword(A) ::= UNIQUE. reserved_keyword(A) ::= USER. reserved_keyword(A) ::= USING. reserved_keyword(A) ::= VARIADIC. reserved_keyword(A) ::= WHEN. reserved_keyword(A) ::= WHERE. reserved_keyword(A) ::= WINDOW. reserved_keyword(A) ::= WITH. /* ----- bare_label_keyword ----- */ bare_label_keyword(A) ::= ABORT_P. bare_label_keyword(A) ::= ABSENT. bare_label_keyword(A) ::= ABSOLUTE_P. bare_label_keyword(A) ::= ACCESS. bare_label_keyword(A) ::= ACTION. bare_label_keyword(A) ::= ADD_P. bare_label_keyword(A) ::= ADMIN. bare_label_keyword(A) ::= AFTER. bare_label_keyword(A) ::= AGGREGATE. bare_label_keyword(A) ::= ALL. bare_label_keyword(A) ::= ALSO. bare_label_keyword(A) ::= ALTER. bare_label_keyword(A) ::= ALWAYS. bare_label_keyword(A) ::= ANALYSE. bare_label_keyword(A) ::= ANALYZE. bare_label_keyword(A) ::= AND. bare_label_keyword(A) ::= ANY. bare_label_keyword(A) ::= ASC. bare_label_keyword(A) ::= ASENSITIVE. bare_label_keyword(A) ::= ASSERTION. bare_label_keyword(A) ::= ASSIGNMENT. bare_label_keyword(A) ::= ASYMMETRIC. bare_label_keyword(A) ::= AT. bare_label_keyword(A) ::= ATOMIC. bare_label_keyword(A) ::= ATTACH. bare_label_keyword(A) ::= ATTRIBUTE. bare_label_keyword(A) ::= AUTHORIZATION. bare_label_keyword(A) ::= BACKWARD. bare_label_keyword(A) ::= BEFORE. bare_label_keyword(A) ::= BEGIN_P. bare_label_keyword(A) ::= BETWEEN. bare_label_keyword(A) ::= BIGINT. bare_label_keyword(A) ::= BINARY. bare_label_keyword(A) ::= BIT. bare_label_keyword(A) ::= BOOLEAN_P. bare_label_keyword(A) ::= BOTH. bare_label_keyword(A) ::= BREADTH. bare_label_keyword(A) ::= BY. bare_label_keyword(A) ::= CACHE. bare_label_keyword(A) ::= CALL. bare_label_keyword(A) ::= CALLED. bare_label_keyword(A) ::= CASCADE. bare_label_keyword(A) ::= CASCADED. bare_label_keyword(A) ::= CASE. bare_label_keyword(A) ::= CAST. bare_label_keyword(A) ::= CATALOG_P. bare_label_keyword(A) ::= CHAIN. bare_label_keyword(A) ::= CHARACTERISTICS. bare_label_keyword(A) ::= CHECK. bare_label_keyword(A) ::= CHECKPOINT. bare_label_keyword(A) ::= CLASS. bare_label_keyword(A) ::= CLOSE. bare_label_keyword(A) ::= CLUSTER. bare_label_keyword(A) ::= COALESCE. bare_label_keyword(A) ::= COLLATE. bare_label_keyword(A) ::= COLLATION. bare_label_keyword(A) ::= COLUMN. bare_label_keyword(A) ::= COLUMNS. bare_label_keyword(A) ::= COMMENT. bare_label_keyword(A) ::= COMMENTS. bare_label_keyword(A) ::= COMMIT. bare_label_keyword(A) ::= COMMITTED. bare_label_keyword(A) ::= COMPRESSION. bare_label_keyword(A) ::= CONCURRENTLY. bare_label_keyword(A) ::= CONDITIONAL. bare_label_keyword(A) ::= CONFIGURATION. bare_label_keyword(A) ::= CONFLICT. bare_label_keyword(A) ::= CONNECTION. bare_label_keyword(A) ::= CONSTRAINT. bare_label_keyword(A) ::= CONSTRAINTS. bare_label_keyword(A) ::= CONTENT_P. bare_label_keyword(A) ::= CONTINUE_P. bare_label_keyword(A) ::= CONVERSION_P. bare_label_keyword(A) ::= COPY. bare_label_keyword(A) ::= COST. bare_label_keyword(A) ::= CROSS. bare_label_keyword(A) ::= CSV. bare_label_keyword(A) ::= CUBE. bare_label_keyword(A) ::= CURRENT_P. bare_label_keyword(A) ::= CURRENT_CATALOG. bare_label_keyword(A) ::= CURRENT_DATE. bare_label_keyword(A) ::= CURRENT_ROLE. bare_label_keyword(A) ::= CURRENT_SCHEMA. bare_label_keyword(A) ::= CURRENT_TIME. bare_label_keyword(A) ::= CURRENT_TIMESTAMP. bare_label_keyword(A) ::= CURRENT_USER. bare_label_keyword(A) ::= CURSOR. bare_label_keyword(A) ::= CYCLE. bare_label_keyword(A) ::= DATA_P. bare_label_keyword(A) ::= DATABASE. bare_label_keyword(A) ::= DEALLOCATE. bare_label_keyword(A) ::= DEC. bare_label_keyword(A) ::= DECIMAL_P. bare_label_keyword(A) ::= DECLARE. bare_label_keyword(A) ::= DEFAULT. bare_label_keyword(A) ::= DEFAULTS. bare_label_keyword(A) ::= DEFERRABLE. bare_label_keyword(A) ::= DEFERRED. bare_label_keyword(A) ::= DEFINER. bare_label_keyword(A) ::= DELETE_P. bare_label_keyword(A) ::= DELIMITER. bare_label_keyword(A) ::= DELIMITERS. bare_label_keyword(A) ::= DEPENDS. bare_label_keyword(A) ::= DEPTH. bare_label_keyword(A) ::= DESC. bare_label_keyword(A) ::= DESTINATION. bare_label_keyword(A) ::= DETACH. bare_label_keyword(A) ::= DICTIONARY. bare_label_keyword(A) ::= DISABLE_P. bare_label_keyword(A) ::= DISCARD. bare_label_keyword(A) ::= DISTINCT. bare_label_keyword(A) ::= DO. bare_label_keyword(A) ::= DOCUMENT_P. bare_label_keyword(A) ::= DOMAIN_P. bare_label_keyword(A) ::= DOUBLE_P. bare_label_keyword(A) ::= DROP. bare_label_keyword(A) ::= EACH. bare_label_keyword(A) ::= EDGE. bare_label_keyword(A) ::= ELSE. bare_label_keyword(A) ::= EMPTY_P. bare_label_keyword(A) ::= ENABLE_P. bare_label_keyword(A) ::= ENCODING. bare_label_keyword(A) ::= ENCRYPTED. bare_label_keyword(A) ::= END_P. bare_label_keyword(A) ::= ENFORCED. bare_label_keyword(A) ::= ENUM_P. bare_label_keyword(A) ::= ERROR_P. bare_label_keyword(A) ::= ESCAPE. bare_label_keyword(A) ::= EVENT. bare_label_keyword(A) ::= EXCLUDE. bare_label_keyword(A) ::= EXCLUDING. bare_label_keyword(A) ::= EXCLUSIVE. bare_label_keyword(A) ::= EXECUTE. bare_label_keyword(A) ::= EXISTS. bare_label_keyword(A) ::= EXPLAIN. bare_label_keyword(A) ::= EXPRESSION. bare_label_keyword(A) ::= EXTENSION. bare_label_keyword(A) ::= EXTERNAL. bare_label_keyword(A) ::= EXTRACT. bare_label_keyword(A) ::= FALSE_P. bare_label_keyword(A) ::= FAMILY. bare_label_keyword(A) ::= FINALIZE. bare_label_keyword(A) ::= FIRST_P. bare_label_keyword(A) ::= FLOAT_P. bare_label_keyword(A) ::= FOLLOWING. bare_label_keyword(A) ::= FORCE. bare_label_keyword(A) ::= FOREIGN. bare_label_keyword(A) ::= FORMAT. bare_label_keyword(A) ::= FORWARD. bare_label_keyword(A) ::= FREEZE. bare_label_keyword(A) ::= FULL. bare_label_keyword(A) ::= FUNCTION. bare_label_keyword(A) ::= FUNCTIONS. bare_label_keyword(A) ::= GENERATED. bare_label_keyword(A) ::= GLOBAL. bare_label_keyword(A) ::= GRANTED. bare_label_keyword(A) ::= GRAPH. bare_label_keyword(A) ::= GRAPH_TABLE. bare_label_keyword(A) ::= GREATEST. bare_label_keyword(A) ::= GROUPING. bare_label_keyword(A) ::= GROUPS. bare_label_keyword(A) ::= HANDLER. bare_label_keyword(A) ::= HEADER_P. bare_label_keyword(A) ::= HOLD. bare_label_keyword(A) ::= IDENTITY_P. bare_label_keyword(A) ::= IF_P. bare_label_keyword(A) ::= ILIKE. bare_label_keyword(A) ::= IMMEDIATE. bare_label_keyword(A) ::= IMMUTABLE. bare_label_keyword(A) ::= IMPLICIT_P. bare_label_keyword(A) ::= IMPORT_P. bare_label_keyword(A) ::= IN_P. bare_label_keyword(A) ::= INCLUDE. bare_label_keyword(A) ::= INCLUDING. bare_label_keyword(A) ::= INCREMENT. bare_label_keyword(A) ::= INDENT. bare_label_keyword(A) ::= INDEX. bare_label_keyword(A) ::= INDEXES. bare_label_keyword(A) ::= INHERIT. bare_label_keyword(A) ::= INHERITS. bare_label_keyword(A) ::= INITIALLY. bare_label_keyword(A) ::= INLINE_P. bare_label_keyword(A) ::= INNER_P. bare_label_keyword(A) ::= INOUT. bare_label_keyword(A) ::= INPUT_P. bare_label_keyword(A) ::= INSENSITIVE. bare_label_keyword(A) ::= INSERT. bare_label_keyword(A) ::= INSTEAD. bare_label_keyword(A) ::= INT_P. bare_label_keyword(A) ::= INTEGER. bare_label_keyword(A) ::= INTERVAL. bare_label_keyword(A) ::= INVOKER. bare_label_keyword(A) ::= IS. bare_label_keyword(A) ::= ISOLATION. bare_label_keyword(A) ::= JOIN. bare_label_keyword(A) ::= JSON. bare_label_keyword(A) ::= JSON_ARRAY. bare_label_keyword(A) ::= JSON_ARRAYAGG. bare_label_keyword(A) ::= JSON_EXISTS. bare_label_keyword(A) ::= JSON_OBJECT. bare_label_keyword(A) ::= JSON_OBJECTAGG. bare_label_keyword(A) ::= JSON_QUERY. bare_label_keyword(A) ::= JSON_SCALAR. bare_label_keyword(A) ::= JSON_SERIALIZE. bare_label_keyword(A) ::= JSON_TABLE. bare_label_keyword(A) ::= JSON_VALUE. bare_label_keyword(A) ::= KEEP. bare_label_keyword(A) ::= KEY. bare_label_keyword(A) ::= KEYS. bare_label_keyword(A) ::= LABEL. bare_label_keyword(A) ::= LANGUAGE. bare_label_keyword(A) ::= LARGE_P. bare_label_keyword(A) ::= LAST_P. bare_label_keyword(A) ::= LATERAL_P. bare_label_keyword(A) ::= LEADING. bare_label_keyword(A) ::= LEAKPROOF. bare_label_keyword(A) ::= LEAST. bare_label_keyword(A) ::= LEFT. bare_label_keyword(A) ::= LEVEL. bare_label_keyword(A) ::= LIKE. bare_label_keyword(A) ::= LISTEN. bare_label_keyword(A) ::= LOAD. bare_label_keyword(A) ::= LOCAL. bare_label_keyword(A) ::= LOCALTIME. bare_label_keyword(A) ::= LOCALTIMESTAMP. bare_label_keyword(A) ::= LOCATION. bare_label_keyword(A) ::= LOCK_P. bare_label_keyword(A) ::= LOCKED. bare_label_keyword(A) ::= LOGGED. bare_label_keyword(A) ::= LSN_P. bare_label_keyword(A) ::= MAPPING. bare_label_keyword(A) ::= MATCH. bare_label_keyword(A) ::= MATCHED. bare_label_keyword(A) ::= MATERIALIZED. bare_label_keyword(A) ::= MAXVALUE. bare_label_keyword(A) ::= MERGE. bare_label_keyword(A) ::= MERGE_ACTION. bare_label_keyword(A) ::= METHOD. bare_label_keyword(A) ::= MINVALUE. bare_label_keyword(A) ::= MODE. bare_label_keyword(A) ::= MOVE. bare_label_keyword(A) ::= NAME_P. bare_label_keyword(A) ::= NAMES. bare_label_keyword(A) ::= NATIONAL. bare_label_keyword(A) ::= NATURAL. bare_label_keyword(A) ::= NCHAR. bare_label_keyword(A) ::= NESTED. bare_label_keyword(A) ::= NEW. bare_label_keyword(A) ::= NEXT. bare_label_keyword(A) ::= NFC. bare_label_keyword(A) ::= NFD. bare_label_keyword(A) ::= NFKC. bare_label_keyword(A) ::= NFKD. bare_label_keyword(A) ::= NO. bare_label_keyword(A) ::= NODE. bare_label_keyword(A) ::= NONE. bare_label_keyword(A) ::= NORMALIZE. bare_label_keyword(A) ::= NORMALIZED. bare_label_keyword(A) ::= NOT. bare_label_keyword(A) ::= NOTHING. bare_label_keyword(A) ::= NOTIFY. bare_label_keyword(A) ::= NOWAIT. bare_label_keyword(A) ::= NULL_P. bare_label_keyword(A) ::= NULLIF. bare_label_keyword(A) ::= NULLS_P. bare_label_keyword(A) ::= NUMERIC. bare_label_keyword(A) ::= OBJECT_P. bare_label_keyword(A) ::= OBJECTS_P. bare_label_keyword(A) ::= OF. bare_label_keyword(A) ::= OFF. bare_label_keyword(A) ::= OIDS. bare_label_keyword(A) ::= OLD. bare_label_keyword(A) ::= OMIT. bare_label_keyword(A) ::= ONLY. bare_label_keyword(A) ::= OPERATOR. bare_label_keyword(A) ::= OPTION. bare_label_keyword(A) ::= OPTIONS. bare_label_keyword(A) ::= OR. bare_label_keyword(A) ::= ORDINALITY. bare_label_keyword(A) ::= OTHERS. bare_label_keyword(A) ::= OUT_P. bare_label_keyword(A) ::= OUTER_P. bare_label_keyword(A) ::= OVERLAY. bare_label_keyword(A) ::= OVERRIDING. bare_label_keyword(A) ::= OWNED. bare_label_keyword(A) ::= OWNER. bare_label_keyword(A) ::= PARALLEL. bare_label_keyword(A) ::= PARAMETER. bare_label_keyword(A) ::= PARSER. bare_label_keyword(A) ::= PARTIAL. bare_label_keyword(A) ::= PARTITION. bare_label_keyword(A) ::= PARTITIONS. bare_label_keyword(A) ::= PASSING. bare_label_keyword(A) ::= PASSWORD. bare_label_keyword(A) ::= PATH. bare_label_keyword(A) ::= PERIOD. bare_label_keyword(A) ::= PLACING. bare_label_keyword(A) ::= PLAN. bare_label_keyword(A) ::= PLANS. bare_label_keyword(A) ::= POLICY. bare_label_keyword(A) ::= POSITION. bare_label_keyword(A) ::= PRECEDING. bare_label_keyword(A) ::= PREPARE. bare_label_keyword(A) ::= PREPARED. bare_label_keyword(A) ::= PRESERVE. bare_label_keyword(A) ::= PRIMARY. bare_label_keyword(A) ::= PRIOR. bare_label_keyword(A) ::= PRIVILEGES. bare_label_keyword(A) ::= PROCEDURAL. bare_label_keyword(A) ::= PROCEDURE. bare_label_keyword(A) ::= PROCEDURES. bare_label_keyword(A) ::= PROGRAM. bare_label_keyword(A) ::= PROPERTIES. bare_label_keyword(A) ::= PROPERTY. bare_label_keyword(A) ::= PUBLICATION. bare_label_keyword(A) ::= QUOTE. bare_label_keyword(A) ::= QUOTES. bare_label_keyword(A) ::= RANGE. bare_label_keyword(A) ::= READ. bare_label_keyword(A) ::= REAL. bare_label_keyword(A) ::= REASSIGN. bare_label_keyword(A) ::= RECURSIVE. bare_label_keyword(A) ::= REF_P. bare_label_keyword(A) ::= REFERENCES. bare_label_keyword(A) ::= REFERENCING. bare_label_keyword(A) ::= REFRESH. bare_label_keyword(A) ::= REINDEX. bare_label_keyword(A) ::= RELATIONSHIP. bare_label_keyword(A) ::= RELATIVE_P. bare_label_keyword(A) ::= RELEASE. bare_label_keyword(A) ::= RENAME. bare_label_keyword(A) ::= REPACK. bare_label_keyword(A) ::= REPEATABLE. bare_label_keyword(A) ::= REPLACE. bare_label_keyword(A) ::= REPLICA. bare_label_keyword(A) ::= RESET. bare_label_keyword(A) ::= RESTART. bare_label_keyword(A) ::= RESTRICT. bare_label_keyword(A) ::= RETURN. bare_label_keyword(A) ::= RETURNS. bare_label_keyword(A) ::= REVOKE. bare_label_keyword(A) ::= RIGHT. bare_label_keyword(A) ::= ROLE. bare_label_keyword(A) ::= ROLLBACK. bare_label_keyword(A) ::= ROLLUP. bare_label_keyword(A) ::= ROUTINE. bare_label_keyword(A) ::= ROUTINES. bare_label_keyword(A) ::= ROW. bare_label_keyword(A) ::= ROWS. bare_label_keyword(A) ::= RULE. bare_label_keyword(A) ::= SAVEPOINT. bare_label_keyword(A) ::= SCALAR. bare_label_keyword(A) ::= SCHEMA. bare_label_keyword(A) ::= SCHEMAS. bare_label_keyword(A) ::= SCROLL. bare_label_keyword(A) ::= SEARCH. bare_label_keyword(A) ::= SECURITY. bare_label_keyword(A) ::= SELECT. bare_label_keyword(A) ::= SEQUENCE. bare_label_keyword(A) ::= SEQUENCES. bare_label_keyword(A) ::= SERIALIZABLE. bare_label_keyword(A) ::= SERVER. bare_label_keyword(A) ::= SESSION. bare_label_keyword(A) ::= SESSION_USER. bare_label_keyword(A) ::= SET. bare_label_keyword(A) ::= SETOF. bare_label_keyword(A) ::= SETS. bare_label_keyword(A) ::= SHARE. bare_label_keyword(A) ::= SHOW. bare_label_keyword(A) ::= SIMILAR. bare_label_keyword(A) ::= SIMPLE. bare_label_keyword(A) ::= SKIP. bare_label_keyword(A) ::= SMALLINT. bare_label_keyword(A) ::= SNAPSHOT. bare_label_keyword(A) ::= SOME. bare_label_keyword(A) ::= SOURCE. bare_label_keyword(A) ::= SPLIT. bare_label_keyword(A) ::= SQL_P. bare_label_keyword(A) ::= STABLE. bare_label_keyword(A) ::= STANDALONE_P. bare_label_keyword(A) ::= START. bare_label_keyword(A) ::= STATEMENT. bare_label_keyword(A) ::= STATISTICS. bare_label_keyword(A) ::= STDIN. bare_label_keyword(A) ::= STDOUT. bare_label_keyword(A) ::= STORAGE. bare_label_keyword(A) ::= STORED. bare_label_keyword(A) ::= STRICT_P. bare_label_keyword(A) ::= STRING_P. bare_label_keyword(A) ::= STRIP_P. bare_label_keyword(A) ::= SUBSCRIPTION. bare_label_keyword(A) ::= SUBSTRING. bare_label_keyword(A) ::= SUPPORT. bare_label_keyword(A) ::= SYMMETRIC. bare_label_keyword(A) ::= SYSID. bare_label_keyword(A) ::= SYSTEM_P. bare_label_keyword(A) ::= SYSTEM_USER. bare_label_keyword(A) ::= TABLE. bare_label_keyword(A) ::= TABLES. bare_label_keyword(A) ::= TABLESAMPLE. bare_label_keyword(A) ::= TABLESPACE. bare_label_keyword(A) ::= TARGET. bare_label_keyword(A) ::= TEMP. bare_label_keyword(A) ::= TEMPLATE. bare_label_keyword(A) ::= TEMPORARY. bare_label_keyword(A) ::= TEXT_P. bare_label_keyword(A) ::= THEN. bare_label_keyword(A) ::= TIES. bare_label_keyword(A) ::= TIME. bare_label_keyword(A) ::= TIMESTAMP. bare_label_keyword(A) ::= TRAILING. bare_label_keyword(A) ::= TRANSACTION. bare_label_keyword(A) ::= TRANSFORM. bare_label_keyword(A) ::= TREAT. bare_label_keyword(A) ::= TRIGGER. bare_label_keyword(A) ::= TRIM. bare_label_keyword(A) ::= TRUE_P. bare_label_keyword(A) ::= TRUNCATE. bare_label_keyword(A) ::= TRUSTED. bare_label_keyword(A) ::= TYPE_P. bare_label_keyword(A) ::= TYPES_P. bare_label_keyword(A) ::= UESCAPE. bare_label_keyword(A) ::= UNBOUNDED. bare_label_keyword(A) ::= UNCOMMITTED. bare_label_keyword(A) ::= UNCONDITIONAL. bare_label_keyword(A) ::= UNENCRYPTED. bare_label_keyword(A) ::= UNIQUE. bare_label_keyword(A) ::= UNKNOWN. bare_label_keyword(A) ::= UNLISTEN. bare_label_keyword(A) ::= UNLOGGED. bare_label_keyword(A) ::= UNTIL. bare_label_keyword(A) ::= UPDATE. bare_label_keyword(A) ::= USER. bare_label_keyword(A) ::= USING. bare_label_keyword(A) ::= VACUUM. bare_label_keyword(A) ::= VALID. bare_label_keyword(A) ::= VALIDATE. bare_label_keyword(A) ::= VALIDATOR. bare_label_keyword(A) ::= VALUE_P. bare_label_keyword(A) ::= VALUES. bare_label_keyword(A) ::= VARCHAR. bare_label_keyword(A) ::= VARIADIC. bare_label_keyword(A) ::= VERBOSE. bare_label_keyword(A) ::= VERSION_P. bare_label_keyword(A) ::= VERTEX. bare_label_keyword(A) ::= VIEW. bare_label_keyword(A) ::= VIEWS. bare_label_keyword(A) ::= VIRTUAL. bare_label_keyword(A) ::= VOLATILE. bare_label_keyword(A) ::= WAIT. bare_label_keyword(A) ::= WHEN. bare_label_keyword(A) ::= WHITESPACE_P. bare_label_keyword(A) ::= WORK. bare_label_keyword(A) ::= WRAPPER. bare_label_keyword(A) ::= WRITE. bare_label_keyword(A) ::= XML_P. bare_label_keyword(A) ::= XMLATTRIBUTES. bare_label_keyword(A) ::= XMLCONCAT. bare_label_keyword(A) ::= XMLELEMENT. bare_label_keyword(A) ::= XMLEXISTS. bare_label_keyword(A) ::= XMLFOREST. bare_label_keyword(A) ::= XMLNAMESPACES. bare_label_keyword(A) ::= XMLPARSE. bare_label_keyword(A) ::= XMLPI. bare_label_keyword(A) ::= XMLROOT. bare_label_keyword(A) ::= XMLSERIALIZE. bare_label_keyword(A) ::= XMLTABLE. bare_label_keyword(A) ::= YES_P. bare_label_keyword(A) ::= ZONE. /* End of grammar: 782 non-terminals, 3584 alternatives */